forked from kutu48/Hexacore-Auto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
184 lines (158 loc) · 7.12 KB
/
bot.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
import requests
import random
import time
import urllib.parse
import json
# Fungsi untuk membaca data dari file data.txt dan extract user_id
def load_user_data(filename):
with open(filename, "r") as file:
data = file.readlines()
user_data = []
for line in data:
# Extract the `user` part of the payload
parsed_data = urllib.parse.parse_qs(line.strip())
user_info = parsed_data.get('user', [None])[0]
if user_info:
user_info_decoded = urllib.parse.unquote(user_info)
user_info_dict = json.loads(user_info_decoded) # Using json.loads instead of eval for safety
user_id = user_info_dict.get("id")
username = user_info_dict.get("username")
user_data.append((user_id, username, line.strip()))
return user_data
# URL dan Header
login_url = "https://ago-api.hexacore.io/api/app-auth" # Pastikan ini didefinisikan di sini
user_exists_url = "https://ago-api.hexacore.io/api/user-exists"
balance_url_template = "https://ago-api.hexacore.io/api/balance/{}"
cekin_url = "https://ago-api.hexacore.io/api/daily-checkin"
cek_taps_url = "https://ago-api.hexacore.io/api/available-taps"
buy_taps_url = "https://ago-api.hexacore.io/api/buy-tap-passes"
klik_url = "https://ago-api.hexacore.io/api/mining-complete"
headers = {
"Content-Type": "application/json",
"Origin": "https://ago-wallet.hexacore.io",
"Referer": "https://ago-wallet.hexacore.io/",
"Sec-Ch-Ua": '"Not/A)Brand";v="8", "Chromium";v="126", "Microsoft Edge";v="126", "Microsoft Edge WebView2";v="126"',
"Sec-Ch-Ua-Mobile": "?0",
"Sec-Ch-Ua-Platform": '"Windows"',
"Sec-Fetch-Dest": "empty",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Site": "same-site",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0"
}
# Fungsi untuk login dan mendapatkan token dari data.txt
def login_from_data(data_line):
payload = {"data": data_line}
print(f"@mitomchanel")
response = requests.post(login_url, json=payload, headers=headers)
try:
response_data = response.json()
token = response_data.get("token")
if token:
# Extract user_info part to get user_id
parsed_data = urllib.parse.parse_qs(data_line)
user_info = parsed_data.get('user', [None])[0]
if user_info:
user_info_decoded = urllib.parse.unquote(user_info)
print(f"Decoded user_info: ........") # Debug print
user_info_dict = json.loads(user_info_decoded) # Safely parse JSON-like string
user_id = user_info_dict.get("id")
print(f"Token: ........")
return token, user_id
except requests.exceptions.JSONDecodeError:
print("Gagal mendekode respons JSON. Konten respons:")
print(response.text)
return None, None
# Fungsi untuk memeriksa apakah user sudah ada
def check_user_exists(token):
headers['Authorization'] = token
response = requests.get(user_exists_url, headers=headers)
return response.json().get("exists")
# Fungsi untuk mendapatkan balance
def get_balance(user_id, token):
balance_url = balance_url_template.format(user_id)
headers['Authorization'] = token
response = requests.get(balance_url, headers=headers)
if response.status_code == 200:
try:
balance_data = response.json()
return balance_data.get("user_id"), balance_data.get("balance")
except requests.exceptions.JSONDecodeError:
print("Failed to decode JSON response during balance retrieval. Response content:")
print(response.text)
return None, None
else:
print(f"Failed to retrieve balance. HTTP Status Code: {response.status_code}")
print("Response content:")
print(response.text)
return None, None
# Fungsi untuk daily check-in
def daily_checkin(token):
headers['Authorization'] = token
cekin_payload = {"day": random.randint(1, 20)}
response = requests.post(cekin_url, json=cekin_payload, headers=headers)
return response.json().get("available_at"), response.json().get("success")
# Fungsi untuk cek taps yang tersedia
def check_available_taps(token):
headers['Authorization'] = token
response = requests.get(cek_taps_url, headers=headers)
return response.json().get("available_taps")
# Fungsi untuk membeli taps
def buy_taps(token):
headers['Authorization'] = token
buy_taps_options = ["1_days", "3_days", "7_days"]
buy_taps_payload = {"name": random.choice(buy_taps_options)}
response = requests.post(buy_taps_url, json=buy_taps_payload, headers=headers)
try:
response_data = response.json()
return response_data.get("success")
except requests.exceptions.JSONDecodeError:
print("Gagal mendekode respons JSON. Konten respons:")
print(response.text)
return None
# Fungsi untuk melakukan klik mining
def mining_complete(token):
headers['Authorization'] = token
klik_payload = {"taps": random.randint(247, 3850)}
response = requests.post(klik_url, json=klik_payload, headers=headers)
print(f"Đã Tap: {klik_payload}")
return response.json().get("success")
# Fungsi utama untuk menjalankan seluruh alur proses secara bergantian untuk setiap user
def main():
data_file = "data.txt"
user_data_list = load_user_data(data_file)
while True:
for user_id, username, data_line in user_data_list:
print(f"\nTài Khoản: {username} (ID: {user_id})")
token, user_id = login_from_data(data_line)
if token:
print(f"Token: Login thành công")
# Check user exists
exists = check_user_exists(token)
print(f"User Exists: {exists}")
# Get balance
user_id, balance = get_balance(user_id, token)
print(f"User ID: {user_id}, Balance: {balance}")
# Daily check-in
available_at, success = daily_checkin(token)
print(f"Daily Check-in: Success={success}, Available at={available_at}")
# Check available taps
available_taps = check_available_taps(token)
print(f"Available Taps: {available_taps}")
# Buy taps
success = buy_taps(token)
print(f"Buy Taps: Success={success}")
# Mining complete
success = mining_complete(token)
print(f"Mining Complete: Success={success}")
# Countdown before next user iteration
delay = random.randint(6, 11)
print(f"Waiting for {delay} seconds before processing next user...")
for i in range(delay, 0, -1):
print(f"{i} seconds remaining...", end="\r")
time.sleep(1)
else:
print("Login failed!")
print("\nAll users processed. Starting the next cycle...")
time.sleep(30) # Delay before starting the next full cycle of all users
if __name__ == "__main__":
main()