-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathmain.py
137 lines (105 loc) · 3.97 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
import asyncio
import sys
import random
from typing import Any
import urllib3
from loguru import logger
from loader import config, semaphore
from core.bot import Bot
from models import Account
from console import Console
from utils import export_trees_ids
def setup():
urllib3.disable_warnings()
logger.remove()
logger.add(
sys.stdout,
colorize=True,
format="<light-cyan>{time:HH:mm:ss}</light-cyan> | <level> {level: <8}</level> | - <white>{"
"message}</white>",
)
logger.add("logs.log", rotation="1 day", retention="7 days")
async def run_safe(account: Account):
async with semaphore:
await Bot(account).start()
async def run_get_tree_info_module(account: Account) -> tuple[Any, bool | str]:
async with semaphore:
client = Bot(account)
tree_id = await client.process_get_tree_id()
if tree_id:
logger.info(f"Account: {account.auth_token} | Tree ID: {tree_id}")
return client.keypair.address, tree_id
# ------------------------
# Start Upgrade from Mr. X
# ------------------------
async def run_total_user(account: Account):
return await Bot(account).process_total_user()
async def run_find_and_steal_rewards_module(account: Account, start: int, end: int, min_amount: int = None):
async with semaphore:
await Bot(account).process_find_and_steal_rewards(start, end, min_amount)
# ------------------------
# End Upgrade from Mr. X
# ------------------------
async def run():
while True:
Console().build()
if config.module in (
"bridge",
"rewards",
"tasks",
"fix_sign",
"mint_comm_nft",
"only_rewards",
"mint_omnihub",
"mint_make_nft_great_again",
"mint_summer_nft",
"mint_flag",
"mint_shop",
"mint_air3",
"mint_supermint",
"comet_bridge",
"mint_all_nfts",
"mint_owlto_summer_nft",
"mint_omnihub_summer_nft",
"mint_random_all_nfts",
"mint_vip3_nft",
"mint_green_id",
"mint_gainfi_nft",
):
tasks = [
asyncio.create_task(run_safe(account)) for account in config.accounts
]
await asyncio.gather(*tasks)
elif config.module == "export_trees_ids":
tasks = [
asyncio.create_task(run_get_tree_info_module(account))
for account in config.accounts
]
results = await asyncio.gather(*tasks)
export_trees_ids(results)
# ------------------------
# Start Upgrade from Mr. X
# ------------------------
elif config.module == "total_user":
return await run_total_user(random.choice(config.accounts))
elif config.module == "find_and_steal_other_trees_rewards":
total_user = await run_total_user(random.choice(config.accounts))
min_amount = config.find_and_steal_min_amount
start_range = int((config.find_and_steal_percentage_range_start / 100) * total_user)
end_range = int((config.find_and_steal_percentage_range_end / 100) * total_user)
chunk_size = (end_range - start_range) // len(config.accounts)
tasks = []
for i, account in enumerate(config.accounts):
start = start_range + (i * chunk_size)
end = start + chunk_size if i < len(config.accounts) - 1 else end_range
tasks.append(
asyncio.create_task(run_find_and_steal_rewards_module(account, start, end, min_amount))
)
results = await asyncio.gather(*tasks)
# ------------------------
# End Upgrade from Mr. X
# ------------------------
input("\n\nPress Enter to continue...")
if __name__ == "__main__":
setup()
asyncio.run(run())