-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbot.py
177 lines (150 loc) · 6.85 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
import requests
import random
import time
import urllib.parse
import json
def load_user_data(filename):
with open(filename, "r") as file:
data = file.readlines()
user_data = []
for line in data:
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)
user_id = user_info_dict.get("id")
username = user_info_dict.get("username")
user_data.append((user_id, username, line.strip()))
return user_data
# URLs and Headers
login_url = "https://ago-api.hexacore.io/api/app-auth"
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/",
"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"
}
def login_from_data(data_line):
payload = {"data": data_line}
print("Mengambil Data Untuk Login")
response = requests.post(login_url, json=payload, headers=headers)
try:
response_data = response.json()
token = response_data.get("token")
if token:
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)
user_info_dict = json.loads(user_info_decoded)
user_id = user_info_dict.get("id")
print("Token berhasil didapatkan")
return token, user_id
except requests.exceptions.JSONDecodeError:
print("Gagal mendekode respons JSON. Konten respons:")
print(response.text)
return None, None
def check_user_exists(token):
headers['Authorization'] = token
response = requests.get(user_exists_url, headers=headers)
return response.json().get("exists")
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
def daily_checkin(token, day):
headers['Authorization'] = token
cekin_payload = {"day": day}
response = requests.post(cekin_url, json=cekin_payload, headers=headers)
try:
response_data = response.json()
available_at = response_data.get("available_at")
success = response_data.get("success")
print(f"Check for day {day} | Status Daily Check-in Day {day}: Success={success}, Available at={available_at}")
return available_at, success
except json.JSONDecodeError:
print(f"Check for day {day} | Status Daily Check-in Day {day}: Failed or Invalid Response")
return None, None
except requests.exceptions.RequestException as e:
print(f"Check for day {day} | Status Daily Check-in Day {day}: Failed or Invalid Response")
return None, None
def check_available_taps(token):
headers['Authorization'] = token
response = requests.get(cek_taps_url, headers=headers)
return response.json().get("available_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
def mining_complete(token):
headers['Authorization'] = token
klik_payload = {"taps": random.randint(50, 150)}
response = requests.post(klik_url, json=klik_payload, headers=headers)
print(f"Klik Payload: {klik_payload}")
return response.json().get("success")
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"\nProcessing user: {username} (ID: {user_id})")
token, user_id = login_from_data(data_line)
if token:
print("Token: Sukses Mendapatkan Token")
exists = check_user_exists(token)
print(f"User Exists: {exists}")
user_id, balance = get_balance(user_id, token)
print(f"User ID: {user_id}, Balance: {balance}")
# Loop through each day from 1 to 20 for daily check-in
for day in random.sample(range(1, 21), 20):
available_at, success = daily_checkin(token, day)
if available_at is not None and success is not None:
print(f"Status Daily Check-in Day {day}: Success={success}, Available at={available_at}")
else:
print(f"Status Daily Check-in Day {day}: Failed or Invalid Response")
time.sleep(0) # Delay between check-ins for realism
available_taps = check_available_taps(token)
print(f"Available Taps: {available_taps}")
success = buy_taps(token)
print(f"Buy Taps: Success={success}")
success = mining_complete(token)
print(f"Mining Complete: Success={success}")
delay = random.randint(3, 5)
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(15)
if __name__ == "__main__":
main()