forked from anonieX/alienworldsauto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
281 lines (257 loc) · 8.79 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
import pickle
import random
import time
from datetime import datetime
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
###
driver_path = "C:/Driver/chromedriver.exe" # location of your chromedriver
brave_path = "C:/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe" # location of your Brave browser
d = DesiredCapabilities.CHROME
d['goog:loggingPrefs'] = { 'browser':'ALL' }
option = webdriver.ChromeOptions()
option.add_argument('log-level=3')
option.add_argument('window-size=929, 1012')
option.binary_location = brave_path
driver = webdriver.Chrome(executable_path=driver_path, chrome_options=option, desired_capabilities=d)
main_page = driver.current_window_handle
###
reddit_username = ""
reddit_password = ""
sleeptimeMin = 30 # Minimum time the bot will sleep between actions to look more human
sleeptimeMax = 90 # Maximum time the bot will sleep between actions to look more human
###
debugResolution = True
debugBarsAdd = 0
debugLogfile = "debug.log"
###
version = "1.1.4"
###
driver.get("https://wallet.wax.io/")
def debugger(t = "init"):
nl = "\n"
if t == "init":
f = open(debugLogfile, "w+")
f.write(f"AWA {version} | {datetime.now().strftime('%c')}{nl}")
f.close()
else:
f = open(debugLogfile, "a")
print(t)
f.write(f"{datetime.now().strftime('%X')} | {t}{nl}")
f.close()
def sleeptime():
x = random.randint(sleeptimeMin, sleeptimeMax)
print(f"Going sleep: {x}s")
return x
size = 0,0
def preload(): # logs into wax.io
debugger("Preloading...")
while True:
debugger("Clicking Reddit loggin")
try:
driver.find_element_by_xpath('/html/body/div[1]/div/div/div[2]/div[4]/div/div[9]/button').click()
driver.find_element_by_xpath('/html/body/div[1]/div/div/div[1]/div[1]/div/div[3]/div[1]/div[9]/button').click()
driver.find_element_by_xpath('/html/body/div[1]/div/div/div[2]/div[4]/div[1]/div[9]/button').click()
except:
if driver.current_url.startswith("https://www.reddit.com/"):
debugger("Website is reddit, breaking")
break
else:
time.sleep(0.5)
else:
break
while True:
debugger("Logging in")
try:
driver.find_element_by_xpath('/html/body/div/main/div[1]/div/div[2]/form/fieldset[1]/input').send_keys(reddit_username)
driver.find_element_by_xpath('/html/body/div/main/div[1]/div/div[2]/form/fieldset[2]/input').send_keys(reddit_password)
driver.find_element_by_xpath('/html/body/div/main/div[1]/div/div[2]/form/fieldset[5]/button').click()
except:
time.sleep(0.1)
else:
break
time.sleep(2)
while True:
debugger("Allowing")
try:
driver.find_element_by_xpath('/html/body/div[3]/div/div[2]/form/div/input[1]').click()
except:
time.sleep(0.5)
else:
break
time.sleep(3)
while True:
if driver.current_url != "https://wallet.wax.io/dashboard":
debugger("Waiting for dashboard")
time.sleep(0.6)
else:
break
debugger("Switching to AW")
driver.get("https://play.alienworlds.io/")
global size
debugger(f"DebugRes = {debugResolution}")
debugger(f"Size = {size}")
if debugResolution == False:
size = driver.get_window_size()["width"]/0.5625, driver.get_window_size()["height"]
if debugResolution == True:
size = 500, 500
debugger(f"Size = {size}")
print(size)
debugger(f"Set window to size")
driver.set_window_size(size[0], size[1])
def login(): # login into alienworlds
found = False
time.sleep(5)
while not found:
debugger(f"Waiting for login")
for e in driver.get_log('browser'):
if "Input Manager initialize...\\n" in e["message"]:
found = True
break
time.sleep(0.5)
global size
while True:
_debugLog = driver.get_log('browser')
driver.set_window_size(size[0], size[1])
x = driver.get_window_size()["width"]/2
y = driver.get_window_size()["height"]*0.621761
if debugResolution == True:
x, y = 250, 233
debugger(f"X, Y = {x}, {y}")
debugger(f"Clicking")
ActionChains(driver).move_by_offset(x, y).click().perform()
time.sleep(0.2)
debugger(f"Backing")
ActionChains(driver).move_by_offset(-x, -y).click().perform()
time.sleep(5)
global debugBarsAdd
if driver.get_log('browser') == _debugLog:
if debugBarsAdd > 2:
debugger(f"Reverse scaling window to {size}, {debugBarsAdd}")
size = size[0], size[1]-25
debugBarsAdd = 0
else:
debugger(f"Scaling window to {size}, {debugBarsAdd}")
size = size[0], size[1]+25
debugBarsAdd += 1
else:
break
def miner(force = False): # activates miner menu button
found = False
while not found:
debugger(f"Waiting for miner")
if force == True:
debugger(f"Force miner")
break
for e in driver.get_log('browser'):
if "successfully downloaded and stored in the indexedDB cache" in e["message"]:
found = True
break
time.sleep(0.6)
driver.set_window_size(size[0], size[1])
x = driver.get_window_size()["width"]/1.32714285714
y = driver.get_window_size()["height"]/3.4
if debugResolution == True:
x, y = 405, 105
debugger(f"X, Y = {x}, {y}")
debugger(f"Clicking")
ActionChains(driver).move_by_offset(x, y).click().perform()
time.sleep(0.2)
debugger(f"Backing")
ActionChains(driver).move_by_offset(-x, -y).click().perform()
def mine(force = False): # starts mining
found = False
while not found:
debugger(f"Waiting for mine")
if force == True:
debugger(f"Force mine")
break
for e in driver.get_log('browser'):
if "successfully downloaded and stored in the indexedDB cache" in e["message"]:
found = True
break
time.sleep(0.6)
driver.set_window_size(size[0], size[1])
x = driver.get_window_size()["width"]/2
y = driver.get_window_size()["height"]/1.35
if debugResolution == True:
x, y = 250, 275
debugger(f"X, Y = {x}, {y}")
debugger(f"Clicking")
ActionChains(driver).move_by_offset(x, y).click().perform()
time.sleep(0.2)
debugger(f"Backing")
ActionChains(driver).move_by_offset(-x, -y).click().perform()
def get(force = False): # claims reward
found = False
while not found:
for e in driver.get_log('browser'):
if "end doWork" in e["message"]:
found = True
break
time.sleep(0.6)
driver.set_window_size(size[0], size[1])
x = driver.get_window_size()["width"]/2
y = driver.get_window_size()["height"]/1.9
if debugResolution == True:
x, y = 245, 185
debugger(f"X, Y = {x}, {y}")
debugger(f"Clicking")
ActionChains(driver).move_by_offset(x, y).click().perform()
time.sleep(0.2)
debugger(f"Backing")
ActionChains(driver).move_by_offset(-x, -y).click().perform()
def end(force = False): # resets
found = False
while not found:
debugger(f"Waiting for end")
if force == True:
debugger(f"Force end")
break
for e in driver.get_log('browser'):
if "Loaded Mining" in e["message"]:
found = True
print(found)
break
time.sleep(0.6)
time.sleep(10)
driver.set_window_size(size[0], size[1])
x = driver.get_window_size()["width"]/4.05
y = driver.get_window_size()["height"]/1.52025316456
if debugResolution == True:
x, y = 140, 250
debugger(f"X, Y = {x}, {y}")
debugger(f"Clicking")
ActionChains(driver).move_by_offset(x, y).click().perform()
time.sleep(0.2)
debugger(f"Backing")
ActionChains(driver).move_by_offset(-x, -y).click().perform()
def wait(): # finds sleep time and waits
s = ""
found = False
while not found:
for e in driver.get_log('browser'):
if "until next mine" in e["message"]:
found = True
s = e["message"]
break
time.sleep(0.6)
debugger("Sleeping")
time.sleep(int(s[s.find("mine ")+5:s.find("\"'")])/1000)
debugger("SleepStop")
debugger("init")
preload()
login()
miner()
mine()
get()
end()
wait()
while True:
time.sleep(sleeptime())
mine(True)
time.sleep(sleeptime()/4)
get(True)
end(True)
wait()