-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbot.py
More file actions
611 lines (521 loc) · 30 KB
/
Copy pathbot.py
File metadata and controls
611 lines (521 loc) · 30 KB
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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
from aiohttp import (
ClientResponseError,
ClientSession,
ClientTimeout
)
from aiohttp_socks import ProxyConnector
from datetime import datetime
from colorama import *
import asyncio, random, json, os, pytz
import functools # <<< TAMBAH INI
from seleniumbase import SB
wib = pytz.timezone('Asia/Jakarta')
USER_AGENT = [
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:120.0) Gecko/20100101 Firefox/120.0",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:121.0) Gecko/20100101 Firefox/121.0",
"Mozilla/5.0 (X11; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1 Safari/605.1.15",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 OPR/106.0.0.0"
]
HEADERS = {
"Accept": "application/json, text/plain, */*",
"Accept-Language": "id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7",
"Origin": "https://monami.network",
"Referer": "https://monami.network/",
"Sec-Fetch-Dest": "empty",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Site": "same-site",
"User-Agent": random.choice(USER_AGENT)
}
class Monami:
def __init__(self) -> None:
self.HEADERS = {}
self.BASE_API = "https://api.monami.network"
self.proxies = []
self.proxy_index = 0
self.account_proxies = {}
self.password = {}
self.access_tokens = {}
self.tokens_output_path = os.path.join(os.getcwd(), "tokens.txt")
def clear_terminal(self):
os.system('cls' if os.name == 'nt' else 'clear')
def log(self, message):
print(
f"{Fore.CYAN + Style.BRIGHT}[ {datetime.now().astimezone(wib).strftime('%x %X %Z')} ]{Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT} | {Style.RESET_ALL}{message}",
flush=True
)
def welcome(self):
print(Fore.LIGHTGREEN_EX + Style.BRIGHT + "\n" + "═" * 60)
print(Fore.GREEN + Style.BRIGHT + " ⚡ Auto Connect Node Ping BOT ⚡")
print(Fore.CYAN + Style.BRIGHT + " ────────────────────────────────")
print(Fore.YELLOW + Style.BRIGHT + " 🧠 Project : Monami - Automation Bot")
print(Fore.YELLOW + Style.BRIGHT + " 🧑💻 Author : YetiDAO")
print(Fore.YELLOW + Style.BRIGHT + " 🌐 Status : Active & Listening...")
print(Fore.CYAN + Style.BRIGHT + " ────────────────────────────────")
print(Fore.MAGENTA + Style.BRIGHT + " 🧬 Powered by Cryptodai3 × YetiDAO | Buddy v1.0 🚀")
print(Fore.LIGHTGREEN_EX + Style.BRIGHT + "═" * 60 + "\n")
def format_seconds(self, seconds):
hours, remainder = divmod(seconds, 3600)
minutes, seconds = divmod(remainder, 60)
return f"{int(hours):02}:{int(minutes):02}:{int(seconds):02}"
def load_accounts(self):
filename = "accounts.json"
try:
if not os.path.exists(filename):
self.log(f"{Fore.RED}File {filename} Not Found.{Style.RESET_ALL}")
return
with open(filename, 'r') as file:
data = json.load(file)
if isinstance(data, list):
return data
return []
except json.JSONDecodeError:
return []
async def load_proxies(self, use_proxy_choice: int):
filename = "proxy.txt"
try:
if use_proxy_choice == 1:
async with ClientSession(timeout=ClientTimeout(total=30)) as session:
async with session.get("https://api.proxyscrape.com/v4/free-proxy-list/get?request=display_proxies&proxy_format=protocolipport&format=text") as response:
response.raise_for_status()
content = await response.text()
with open(filename, 'w') as f:
f.write(content)
self.proxies = [line.strip() for line in content.splitlines() if line.strip()]
else:
if not os.path.exists(filename):
self.log(f"{Fore.RED + Style.BRIGHT}File {filename} Not Found.{Style.RESET_ALL}")
return
with open(filename, 'r') as f:
self.proxies = [line.strip() for line in f.read().splitlines() if line.strip()]
if not self.proxies:
self.log(f"{Fore.RED + Style.BRIGHT}No Proxies Found.{Style.RESET_ALL}")
return
self.log(
f"{Fore.GREEN + Style.BRIGHT}Proxies Total : {Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT}{len(self.proxies)}{Style.RESET_ALL}"
)
except Exception as e:
self.log(f"{Fore.RED + Style.BRIGHT}Failed To Load Proxies: {e}{Style.RESET_ALL}")
self.proxies = []
def check_proxy_schemes(self, proxies):
schemes = ["http://", "https://", "socks4://", "socks5://"]
if any(proxies.startswith(scheme) for scheme in schemes):
return proxies
return f"http://{proxies}"
def get_next_proxy_for_account(self, email):
if email not in self.account_proxies:
if not self.proxies:
return None
proxy = self.check_proxy_schemes(self.proxies[self.proxy_index])
self.account_proxies[email] = proxy
self.proxy_index = (self.proxy_index + 1) % len(self.proxies)
return self.account_proxies[email]
def rotate_proxy_for_account(self, email):
if not self.proxies:
return None
proxy = self.check_proxy_schemes(self.proxies[self.proxy_index])
self.account_proxies[email] = proxy
self.proxy_index = (self.proxy_index + 1) % len(self.proxies)
return proxy
def mask_account(self, account):
if "@" in account:
local, domain = account.split('@', 1)
mask_account = local[:3] + '*' * 3 + local[-3:]
return f"{mask_account}@{domain}"
mask_account = account[:3] + '*' * 3 + account[-3:]
return mask_account
def print_message(self, account, proxy, color, message):
self.log(
f"{Fore.CYAN + Style.BRIGHT}[ Account:{Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT} {self.mask_account(account)} {Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT}-{Style.RESET_ALL}"
f"{Fore.CYAN + Style.BRIGHT} Proxy: {Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT}{proxy}{Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT} - {Style.RESET_ALL}"
f"{Fore.CYAN + Style.BRIGHT}Status:{Style.RESET_ALL}"
f"{color + Style.BRIGHT} {message} {Style.RESET_ALL}"
f"{Fore.CYAN + Style.BRIGHT}]{Style.RESET_ALL}"
)
def print_question(self):
while True:
try:
print(f"{Fore.WHITE + Style.BRIGHT}1. Run With Free Proxyscrape Proxy{Style.RESET_ALL}")
print(f"{Fore.WHITE + Style.BRIGHT}2. Run With Private Proxy{Style.RESET_ALL}")
print(f"{Fore.WHITE + Style.BRIGHT}3. Run Without Proxy{Style.RESET_ALL}")
choose = int(input(f"{Fore.BLUE + Style.BRIGHT}Choose [1/2/3] -> {Style.RESET_ALL}").strip())
if choose in [1, 2, 3]:
proxy_type = (
"With Free Proxyscrape" if choose == 1 else
"With Private" if choose == 2 else
"Without"
)
print(f"{Fore.GREEN + Style.BRIGHT}Run {proxy_type} Proxy Selected.{Style.RESET_ALL}")
break
else:
print(f"{Fore.RED + Style.BRIGHT}Please enter either 1, 2 or 3.{Style.RESET_ALL}")
except ValueError:
print(f"{Fore.RED + Style.BRIGHT}Invalid input. Enter a number (1, 2 or 3).{Style.RESET_ALL}")
rotate = False
if choose in [1, 2]:
while True:
rotate = input(f"{Fore.BLUE + Style.BRIGHT}Rotate Invalid Proxy? [y/n] -> {Style.RESET_ALL}").strip()
if rotate in ["y", "n"]:
rotate = rotate == "y"
break
else:
print(f"{Fore.RED + Style.BRIGHT}Invalid input. Enter 'y' or 'n'.{Style.RESET_ALL}")
return choose, rotate
async def check_connection(self, email: str, proxy=None):
connector = ProxyConnector.from_url(proxy) if proxy else None
try:
async with ClientSession(connector=connector, timeout=ClientTimeout(total=30)) as session: # Reduced timeout for quicker checks
async with session.post(url="http://ip-api.com/json") as response:
response.raise_for_status()
return await response.json()
except (Exception, ClientResponseError) as e:
self.print_message(email, proxy, Fore.RED, f"Connection Not 200 OK: {Fore.YELLOW+Style.BRIGHT}{str(e)}{Style.RESET_ALL}")
return None
def _seleniumbase_login_sync(self, email: str, password: str, max_retries: int, delay_between_retries: int):
login_url = "https://monami.network/signin"
for attempt in range(max_retries):
self.log(f"{Fore.CYAN}Attempting SeleniumBase login for {email} (Attempt {attempt + 1}/{max_retries}){Style.RESET_ALL}")
try:
with SB(uc=True, xvfb=True, headless=True) as sb:
sb.uc_open(login_url)
sb.type('input[name="email"]', email)
sb.type('input[name="password"]', password)
sb.uc_click('button:contains("Sign In")')
sb.sleep(5)
access_token = None
all_cookies = sb.get_cookies()
for cookie in all_cookies:
if cookie.get('name') == 'accessToken': # Adjust if cookie name is different
access_token = cookie.get('value')
break
if access_token:
return {"accessToken": access_token}
else:
self.log(f"{Fore.RED}Access token not found for {email} after SeleniumBase login.{Style.RESET_ALL}")
except Exception as e:
self.log(f"{Fore.RED}Error during SeleniumBase login for {email}: {str(e)}{Style.RESET_ALL}")
if attempt < max_retries - 1:
self.log(f"{Fore.YELLOW}Waiting {delay_between_retries} seconds before retrying...{Style.RESET_ALL}")
time.sleep(delay_between_retries)
else:
self.log(f"{Fore.RED}SeleniumBase login failed for {email} after {max_retries} attempts.{Style.RESET_ALL}")
return None # All retries failed
def _write_token(self, email: str, token: str):
with open(self.tokens_output_path, "a") as f:
f.write(f"{email}:{token}\n")
self.log(f"{Fore.GREEN}Token for {email} successfully written to {self.tokens_output_path}{Style.RESET_ALL}")
async def user_login(self, email: str, proxy=None, retries=5):
loop = asyncio.get_event_loop()
login_result = await loop.run_in_executor(
None, # Use default ThreadPoolExecutor
functools.partial(self._seleniumbase_login_sync, email, self.password[email], retries, 5)
)
if login_result and "accessToken" in login_result:
self.access_tokens[email] = login_result["accessToken"]
self._write_token(email, login_result["accessToken"])
self.print_message(email, proxy, Fore.GREEN, "Login Success (via SeleniumBase)")
return login_result
else:
self.print_message(email, proxy, Fore.RED, "Login Failed (via SeleniumBase after retries)")
return None
async def user_info(self, email: str, use_proxy: bool, rotate_proxy: bool, proxy=None, retries=5):
url = f"{self.BASE_API}/users"
headers = self.HEADERS[email].copy()
headers["Authorization"] = f"Bearer {self.access_tokens[email]}"
for attempt in range(retries):
connector = ProxyConnector.from_url(proxy) if proxy else None
try:
async with ClientSession(connector=connector, timeout=ClientTimeout(total=60)) as session:
async with session.get(url=url, headers=headers, ssl=False) as response:
if response.status == 401:
self.print_message(email, proxy, Fore.YELLOW, "Access token expired, attempting re-login.")
await self.process_user_login(email, use_proxy, rotate_proxy)
headers["Authorization"] = f"Bearer {self.access_tokens[email]}"
continue
response.raise_for_status()
return await response.json()
except (Exception, ClientResponseError) as e:
if attempt < retries - 1:
await asyncio.sleep(5)
continue
self.print_message(email, proxy, Fore.RED, f"GET User Info Failed: {Fore.YELLOW+Style.BRIGHT}{str(e)}{Style.RESET_ALL}")
return None
async def perform_checkin(self, email: str, use_proxy: bool, rotate_proxy: bool, proxy=None, retries=5):
url = f"{self.BASE_API}/users/checkin"
data = json.dumps({"email":email})
headers = self.HEADERS[email].copy()
headers["Authorization"] = f"Bearer {self.access_tokens[email]}"
headers["Content-Length"] = str(len(data))
headers["Content-Type"] = "application/json"
for attempt in range(retries):
connector = ProxyConnector.from_url(proxy) if proxy else None
try:
async with ClientSession(connector=connector, timeout=ClientTimeout(total=60)) as session:
async with session.patch(url=url, headers=headers, data=data, ssl=False) as response:
if response.status == 401:
self.print_message(email, proxy, Fore.YELLOW, "Access token expired, attempting re-login.")
await self.process_user_login(email, use_proxy, rotate_proxy)
headers["Authorization"] = f"Bearer {self.access_tokens[email]}"
continue
response.raise_for_status()
return await response.json()
except (Exception, ClientResponseError) as e:
if attempt < retries - 1:
await asyncio.sleep(5)
continue
self.print_message(email, proxy, Fore.RED, f"Check-In Failed: {Fore.YELLOW+Style.BRIGHT}{str(e)}{Style.RESET_ALL}")
return None
async def connect_node(self, email: str, use_proxy: bool, rotate_proxy: bool, proxy=None, retries=5):
url = f"{self.BASE_API}/points/update-last-active"
data = json.dumps({"email":email})
headers = self.HEADERS[email].copy()
headers["Authorization"] = f"Bearer {self.access_tokens[email]}"
headers["Content-Length"] = str(len(data))
headers["Content-Type"] = "application/json"
for attempt in range(retries):
connector = ProxyConnector.from_url(proxy) if proxy else None
try:
async with ClientSession(connector=connector, timeout=ClientTimeout(total=60)) as session:
async with session.patch(url=url, headers=headers, data=data, ssl=False) as response:
if response.status == 401:
self.print_message(email, proxy, Fore.YELLOW, "Access token expired, attempting re-login.")
await self.process_user_login(email, use_proxy, rotate_proxy)
headers["Authorization"] = f"Bearer {self.access_tokens[email]}"
continue
response.raise_for_status()
return await response.json()
except (Exception, ClientResponseError) as e:
if attempt < retries - 1:
await asyncio.sleep(5)
continue
self.print_message(email, proxy, Fore.RED, f"Lite Node Not Connected: {Fore.YELLOW+Style.BRIGHT}{str(e)}{Style.RESET_ALL}")
return None
async def update_point(self, email: str, use_proxy: bool, rotate_proxy: bool, proxy=None, retries=5):
url = f"{self.BASE_API}/points/update-point?email={email}"
headers = self.HEADERS[email].copy()
headers["Authorization"] = f"Bearer {self.access_tokens[email]}"
for attempt in range(retries):
connector = ProxyConnector.from_url(proxy) if proxy else None
try:
async with ClientSession(connector=connector, timeout=ClientTimeout(total=60)) as session:
async with session.get(url=url, headers=headers, ssl=False) as response:
if response.status == 401:
self.print_message(email, proxy, Fore.YELLOW, "Access token expired, attempting re-login.")
await self.process_user_login(email, use_proxy, rotate_proxy)
headers["Authorization"] = f"Bearer {self.access_tokens[email]}"
continue
response.raise_for_status()
return await response.json()
except (Exception, ClientResponseError) as e:
if attempt < retries - 1:
await asyncio.sleep(5)
continue
self.print_message(email, proxy, Fore.RED, f"Update Point Failed: {Fore.YELLOW+Style.BRIGHT}{str(e)}{Style.RESET_ALL}")
return None
async def task_lists(self, email: str, use_proxy: bool, rotate_proxy: bool, proxy=None, retries=5):
url = f"{self.BASE_API}/tasks/?email={email.replace('@', '%40')}"
headers = self.HEADERS[email].copy()
headers["Authorization"] = f"Bearer {self.access_tokens[email]}"
for attempt in range(retries):
connector = ProxyConnector.from_url(proxy) if proxy else None
try:
async with ClientSession(connector=connector, timeout=ClientTimeout(total=60)) as session:
async with session.get(url=url, headers=headers, ssl=False) as response:
if response.status == 401:
self.print_message(email, proxy, Fore.YELLOW, "Access token expired, attempting re-login.")
await self.process_user_login(email, use_proxy, rotate_proxy)
headers["Authorization"] = f"Bearer {self.access_tokens[email]}"
continue
response.raise_for_status()
return await response.json()
except (Exception, ClientResponseError) as e:
if attempt < retries - 1:
await asyncio.sleep(5)
continue
self.print_message(email, proxy, Fore.RED, f"GET Task Lists Failed: {Fore.YELLOW+Style.BRIGHT}{str(e)}{Style.RESET_ALL}")
return None
async def complete_task(self, email: str, task_field: str, use_proxy: bool, rotate_proxy: bool, proxy=None, retries=5):
url = f"{self.BASE_API}/users/task"
data = json.dumps({"email":email, "field":task_field})
headers = self.HEADERS[email].copy()
headers["Authorization"] = f"Bearer {self.access_tokens[email]}"
headers["Content-Length"] = str(len(data))
headers["Content-Type"] = "application/json"
for attempt in range(retries):
connector = ProxyConnector.from_url(proxy) if proxy else None
try:
async with ClientSession(connector=connector, timeout=ClientTimeout(total=60)) as session:
async with session.patch(url=url, headers=headers, data=data, ssl=False) as response:
if response.status == 401:
self.print_message(email, proxy, Fore.YELLOW, "Access token expired, attempting re-login.")
await self.process_user_login(email, use_proxy, rotate_proxy)
headers["Authorization"] = f"Bearer {self.access_tokens[email]}"
continue
response.raise_for_status()
return await response.json()
except (Exception, ClientResponseError) as e:
if attempt < retries - 1:
await asyncio.sleep(5)
continue
self.print_message(email, proxy, Fore.WHITE, f"Task {task_field}{Fore.RED+Style.BRIGHT} Not Completed: {Fore.YELLOW+Style.BRIGHT}{str(e)}{Style.RESET_ALL}")
return None
async def process_check_connection(self, email: str, use_proxy: bool, rotate_proxy: bool):
while True:
proxy = self.get_next_proxy_for_account(email) if use_proxy else None
check = await self.check_connection(email, proxy)
if check and check.get("status") == "success":
return True
if rotate_proxy:
proxy = self.rotate_proxy_for_account(email)
await asyncio.sleep(5)
async def process_user_login(self, email: str, use_proxy: bool, rotate_proxy: bool):
return await self.user_login(email, None) # Proxy is not directly passed to SB within user_login
async def looping_user_login(self, email: str, use_proxy: bool, rotate_proxy: bool):
while True:
await asyncio.sleep(24 * 60 * 55)
await self.user_login(email, None)
async def looping_perform_checkin(self, email: str, use_proxy: bool, rotate_proxy: bool):
while True:
proxy = self.get_next_proxy_for_account(email) if use_proxy else None
users = await self.user_info(email, use_proxy, rotate_proxy, proxy)
if users:
checked_in = users["checkedIn"]
if checked_in:
self.print_message(email, proxy, Fore.YELLOW, "Already Check-In Today")
else:
checkin = await self.perform_checkin(email, use_proxy, rotate_proxy, proxy)
if checkin:
self.print_message(email, proxy, Fore.GREEN, "Check-In Success")
await asyncio.sleep(12 * 60 * 60)
async def process_connect_node(self, email: str, use_proxy: bool, rotate_proxy: bool):
while True:
proxy = self.get_next_proxy_for_account(email) if use_proxy else None
connect = await self.connect_node(email, use_proxy, rotate_proxy, proxy)
if connect and connect.get("message") == "Last active time updated":
self.print_message(email, proxy, Fore.GREEN, "Lite Node Connected")
return True
await asyncio.sleep(5)
async def looping_connect_node(self, email: str, use_proxy: bool, rotate_proxy: bool):
while True:
await self.process_connect_node(email, use_proxy, rotate_proxy)
await asyncio.sleep(24 * 60 * 60)
async def looping_update_point(self, email: str, use_proxy: bool, rotate_proxy: bool):
while True:
proxy = self.get_next_proxy_for_account(email) if use_proxy else None
update = await self.update_point(email, use_proxy, rotate_proxy, proxy)
if update:
point_today = update["pointsFarmToday"]
point_total = update["totalPointsReceived"]
today_uptime = update["todayUptime"]
total_uptime = update["totalUptime"]
self.print_message(email, proxy, Fore.GREEN, "Point Updated"
f"{Fore.MAGENTA + Style.BRIGHT} - {Style.RESET_ALL}"
f"{Fore.CYAN + Style.BRIGHT}Earning:{Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT} Today {point_today:.3f} {Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT}-{Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT} Total {point_total:.3f} {Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT}-{Style.RESET_ALL}"
f"{Fore.CYAN + Style.BRIGHT} Uptime: {Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT}Today {today_uptime}{Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT} - {Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT}Total {total_uptime}{Style.RESET_ALL}"
)
await asyncio.sleep(90)
async def looping_complete_tasks(self, email: str, use_proxy: bool, rotate_proxy: bool):
while True:
proxy = self.get_next_proxy_for_account(email) if use_proxy else None
task_lists = await self.task_lists(email, use_proxy, rotate_proxy, proxy)
if task_lists:
tasks = [
(key, value) for key, value in task_lists.items()
if key not in ['_id', 'email', '__v']
]
for task_filed, status in tasks:
if status is True:
continue
complete = await self.complete_task(email, task_filed, use_proxy, rotate_proxy, proxy)
if complete:
self.print_message(email, proxy, Fore.WHITE, f"Task {task_filed} "
f"{Fore.GREEN + Style.BRIGHT}Is Completed{Style.RESET_ALL}"
)
await asyncio.sleep(1)
self.print_message(email, proxy, Fore.GREEN, "All Available Tasks Have Been Processed")
await asyncio.sleep(24 * 60 * 60)
async def process_accounts(self, email: str, use_proxy: bool, rotate_proxy: bool):
logined = await self.process_user_login(email, use_proxy, rotate_proxy)
if logined:
tasks = [
asyncio.create_task(self.looping_user_login(email, use_proxy, rotate_proxy)),
asyncio.create_task(self.looping_perform_checkin(email, use_proxy, rotate_proxy)),
asyncio.create_task(self.looping_connect_node(email, use_proxy, rotate_proxy)),
asyncio.create_task(self.looping_update_point(email, use_proxy, rotate_proxy)),
asyncio.create_task(self.looping_complete_tasks(email, use_proxy, rotate_proxy))
]
await asyncio.gather(*tasks)
async def main(self):
try:
accounts = self.load_accounts()
if not accounts:
self.log(f"{Fore.RED + Style.BRIGHT}No Accounts Loaded.{Style.RESET_ALL}")
return
use_proxy_choice, rotate_proxy = self.print_question()
use_proxy = False
if use_proxy_choice in [1, 2]:
use_proxy = True
self.clear_terminal()
self.welcome()
self.log(
f"{Fore.GREEN + Style.BRIGHT}Account's Total: {Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT}{len(accounts)}{Style.RESET_ALL}"
)
if use_proxy:
await self.load_proxies(use_proxy_choice)
self.log(f"{Fore.CYAN + Style.BRIGHT}={Style.RESET_ALL}"*75)
tasks = []
for idx, account in enumerate(accounts, start=1):
if account:
email = account["Email"]
password = account["Password"]
if not "@" in email or not password:
self.log(
f"{Fore.CYAN + Style.BRIGHT}[ Account: {Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT}{idx}{Style.RESET_ALL}"
f"{Fore.MAGENTA + Style.BRIGHT} - {Style.RESET_ALL}"
f"{Fore.CYAN + Style.BRIGHT}Status:{Style.RESET_ALL}"
f"{Fore.RED + Style.BRIGHT} Invalid Account Data {Style.RESET_ALL}"
f"{Fore.CYAN + Style.BRIGHT}]{Style.RESET_ALL}"
)
continue
self.HEADERS[email] = HEADERS
self.password[email] = password
tasks.append(asyncio.create_task(self.process_accounts(email, use_proxy, rotate_proxy)))
await asyncio.gather(*tasks)
except Exception as e:
self.log(f"{Fore.RED+Style.BRIGHT}Error: {e}{Style.RESET_ALL}")
raise e
if __name__ == "__main__":
try:
bot = Monami()
asyncio.run(bot.main())
except KeyboardInterrupt:
print(
f"{Fore.CYAN + Style.BRIGHT}[ {datetime.now().astimezone(wib).strftime('%x %X %Z')} ]{Style.RESET_ALL}"
f"{Fore.WHITE + Style.BRIGHT} | {Style.RESET_ALL}"
f"{Fore.RED + Style.BRIGHT}[ EXIT ] Monami Network - BOT{Style.RESET_ALL} "
)