This repository has been archived by the owner on Apr 7, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
main.py
164 lines (146 loc) · 7.02 KB
/
main.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#!/usr/bin/python2.7
# -*- coding: utf-8
from console import Console
from update import Update
from botnet import Botnet
from player import Player
from mails import Mails
import time
import json
import config
import ddos
import logging
logger = logging.getLogger(__name__)
FORMAT = '%(asctime)s [%(threadName)10s][%(module)10s][%(levelname)8s] %(message)s'
logging.basicConfig(level=logging.INFO, format=FORMAT)
class run:
def __init__(self):
"""
Pull all variables from config.py file.
"""
self.player = Player()
self.database = config.database
self.Max_point_tournament = config.Max_point_tournament
self.BotNet_update = config.BotNet_update
self.joinTournament = config.joinTournament
self.tournament_potator = config.tournament_potator
self.booster = config.booster
self.Use_netcoins = config.Use_netcoins
self.attacks_normal = config.attacks_normal
self.updates = config.updates
self.updatecount = config.updatecount
self.maxanti_normal = config.maxanti_normal
self.active_cluster_protection = config.active_cluster_protection
self.mode = config.mode
self.number_task = config.number_task
self.min_energy_botnet = config.minimal_energy_botnet_upgrade
self.stat = "0"
self.wait_load = config.wait_load
self.c = Console(self.player)
self.u = Update(self.player)
# disable botnet for > api v13
self.b = Botnet(self.player)
self.ddos = ddos.Ddos(self.player)
self.m = Mails(self.player)
self.init()
def init(self):
while True:
# update the player
time.sleep(self.wait_load)
stat = "0"
# prepare account
if self.number_task:
self.get_max_update = int(self.number_task)
else:
self.get_max_update = int(self.u.infoUpdate("ram", "new")) - 1
self.running_all = self.u.runningtasks()
logger.info("you are running {}/{} tasks".format(self.running_all, self.get_max_update))
if int(self.running_all) < int(self.get_max_update):
while "0" in stat or "3" in stat:
if int(self.u.runningtasks()) < int(self.u.infoUpdate("ram", "new")) - 1 or int(self.u.runningtasks()) < int(self.get_max_update):
try:
moneyforupdate = int(self.u.infoUpdate(self.updates[self.updatecount]))
except IndexError:
logger.info("reset")
self.updatecount = 0
moneyforupdate = int(self.u.infoUpdate(self.updates[self.updatecount]))
stat = "1"
mymoney = int(json.loads(self.c.myinfo())["money"])
if mymoney < moneyforupdate:
self.updatecount += 1
try:
logger.info("require {}$ for update {} your money {}$".format(moneyforupdate, self.updates[self.updatecount], mymoney))
except IndexError:
stat = "1"
totaltask = int(self.u.runningtasks()) + int(self.updatecount)
if int(totaltask) == int(self.get_max_update):
stat = "1"
else:
(stat, levelupdates) = self.u.startTask(self.updates[self.updatecount])
if "3" in stat or "0" in stat:
logger.info("updating {} level {}".format(self.updates[self.updatecount], int(levelupdates)+1))
# print "Started Update
logger.info("Waiting... in update")
# u.useBooster()
self.updatecount += 1
totaltask = int(self.u.runningtasks()) + int(self.updatecount)
if int(totaltask) == int(self.get_max_update):
stat = "1"
else:
break
# recheck running ask for boost and netcoins
self.running_all = self.u.runningtasks()
self.ddos.run_ddos()
if self.BotNet_update:
botnet = json.loads(self.b._botnetInfo())
if int(botnet['count']) > 0 and int(botnet['energy']) >= self.min_energy_botnet:
for count, i in enumerate(botnet['data']):
self.b.upgradebotnet(i['hostname'], int(i['running']), count)
else:
if int(botnet['count']) == 0:
logger.info("You are not botnet")
if int(botnet['energy']) == 0:
logger.info("You are not energy for update botnet")
else:
logger.info("Your botnet energy ("+ str(botnet['energy']) +") < " + str(self.min_energy_botnet) + " Please wait for regeneration...")
# attack botnet
#number_botnet = json.loads(self.b._botnetInfo())
#if int(number_botnet['count']) > 0:
# self.b.attack()
if self.joinTournament and self.c.getTournament():
self.mode = "Potator"
logger.info("** Force Mode to 'Potator' for Tournament **")
# task = self.u.doTasks(self.wait_load)
if self.booster and self.running_all > 1:
try:
vtasks = self.u.getrunningtasks()
json_data = json.loads(vtasks)
while len(json_data["data"]) > 1:
if int(json_data["boost"]) > 5:
json_data = json.loads(self.u.useBooster())
logger.info("Using booster on rest {}".format(json_data["boost"]))
if int(json_data['fAllCosts']) < 50:
break
# UPDATE Value
else:
logger.info("you have < 5 boost.")
break
except Exception as e:
logger.error("Connection Error try again...{0}".format(e))
pass
if self.Use_netcoins:
time.sleep(2)
if self.player.netcoins > 1 and self.running_all > 1:
self.u.finishAll()
self.player.refreshinfo() # update player info
logger.info("I used Netcoins for finish all task.")
if self.player.email > 0:
time.sleep(self.wait_load)
logger.info('Reading mails...')
self.m.read_mails()
# attack players
self.c.attack(self)
# reinitialise your profil money, email ...
run.__init__(self)
if __name__ == "__main__":
r = run()