This repository was archived by the owner on Oct 7, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplayer.py
100 lines (88 loc) · 3.27 KB
/
player.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import config
from utils import Utils
import json
import logging
import sys
logger = logging.getLogger(__name__)
FORMAT = '%(asctime)s [%(threadName)10s][%(module)10s][%(levelname)8s] %(message)s'
logging.basicConfig(level=logging.INFO, format=FORMAT)
class Player:
ut = Utils()
def __init__(self):
self.username = config.user
self.password = config.password
self.money = 0
self.ip = ''
self.score = ''
self.netcoins = ''
self.boosters = ''
self.rank = ''
self.uhash = ''
self.localspyware = ''
self.remotespyware = ''
self.email = 0
self.savedIPs = []
self.anon_attack = config.anon
self._init() # 10 secs
def __repr__(self):
return "Money: {0}, Score: {1}".format(self.money, self.score)
def getplayerinfo(self):
pass
def setmoney(self, amount):
"""
Change class money value, pass in neg or postive values
:param amount:
:return:
"""
self.money = amount
def getmoney(self):
return self.money
def removespy(self):
response = self.ut.requestArray(self.username, self.password, self.uhash, "vh_removeSpyware.php")
return response
def _init(self):
"""
{"id":"924198","money":"14501972","ip":"83.58.131.20",
"inet":"10","hdd":"10","cpu":"10","ram":"14","fw":"256","av":"410","sdk":"580","ipsp":"50","spam":"71","scan":"436","adw":"76",
"actadw":"","netcoins":"5550","energy":"212286963","score":"10015",
"urmail":"1","active":"1","elo":"2880","clusterID":null,"position":null,"syslog":null,
"lastcmsg":"0","rank":32022,"event":"3","bonus":"0","mystery":"0","vipleft":"OFF",
"hash":"91ec5ed746dfedc0a750d896a4e615c4",
"uhash":"9832f717079f8664109ac9854846e753282c72cdf42fe33fb33c734923e1931c","use":"0",
"tournamentActive":"2","boost":"294","actspyware":"0","tos":"1","unreadmsg":"0"}
:return:
"""
data = self.ut.requestString(self.username, self.password, self.uhash, "vh_update.php")
if len(data) == 1:
logging.warn('Username and password entered in config.py?')
sys.exit()
try:
j = json.loads(data)
self.setmoney(j['money'])
self.ip = j['ip']
self.score = j['score']
self.netcoins = j['netcoins']
self.localspyware = j['actspyware']
self.rank = j['rank']
self.boosters = j['boost']
self.remotespyware = j['actadw']
self.email = int(j['urmail'])
self.uhash = str(j['uhash'])
logger.info("\n Your profile :\n\n Your IP: {0}, Your Score: {1}, Your netcoins {2}, \n Your rank: {3}, Your Booster: {4}, Active Spyware {5} \n\n".format(j['ip'], j['score'], j['netcoins'], j['rank'], j['boost'], j['actspyware']))
except:
exit()
def get_uhash(self):
return self.uhash
def refreshinfo(self):
"""
Refresh player info. Useful after a dev attack to pick up new email etc.
:return:
"""
self._init()
def readmail(self):
"""
Read any new emails. Print to console.
:return: None
"""
if self.email:
pass