-
Notifications
You must be signed in to change notification settings - Fork 0
/
cyber.py
292 lines (279 loc) · 10.3 KB
/
cyber.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
282
283
284
285
286
287
288
289
290
291
292
import json
import time
import requests
from eth_account import Account
from eth_account.messages import encode_defunct
headers = {
'Accept': 'application/json',
'Accept-Language': 'en-US,en;q=0.9,id;q=0.8',
'Content-Type': 'application/json',
'Origin': 'https://cyber.deform.cc',
'Privy-App-Id': 'clphlvsh3034xjw0fvs59mrdc',
'Privy-Ca-Id': '649814d3-98c4-4a73-a28d-ad39c448fad0',
'Privy-Client': 'react-auth:1.68.0-beta-20240603143655',
'Referer': 'https://cyber.deform.cc/',
'Sec-Ch-Ua': '"Not_A Brand";v="8", "Chromium";v="120"',
'Sec-Ch-Ua-Mobile': '?0',
'Sec-Ch-Ua-Platform': '"Linux"',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'cross-site',
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'
}
def generate_eth_account():
account = Account.create()
print("\n• Generate Address")
print("New Ethereum Address:" + account.address)
print("Private Key:" + account._private_key.hex())
time.sleep(3)
return account
def init_authentication():
account = generate_eth_account()
print("\n• Get Nonce ")
url_init = "https://auth.privy.io/api/v1/siwe/init"
data_init = {"address": account.address}
response_init = requests.post(url_init, headers=headers, data=json.dumps(data_init)).json()
nonce = response_init['nonce']
issued_at = response_init['expires_at']
print("[-] Nonce :"+ nonce + " " + "Expires at : " + issued_at)
time.sleep(3)
return account, nonce, issued_at
def authenticate():
account, nonce, issued_at = init_authentication()
print("• Auth Login")
url_auth = "https://auth.privy.io/api/v1/siwe/authenticate"
message = (
"cyber.deform.cc wants you to sign in with your Ethereum account:\n" +
account.address + "\n\nBy signing, you are proving you own this wallet and logging in. "
"This does not initiate a transaction or cost any fees.\n\nURI: https://cyber.deform.cc\n"
"Version: 1\nChain ID: 1\nNonce: " + nonce + "\n"
"Issued At: " + issued_at + "\nResources:\n- https://privy.io"
)
message_encoded = encode_defunct(text=message)
signature = Account.sign_message(message_encoded, private_key=account._private_key)
data = {
"message": message,
"signature": signature.signature.hex(),
"chainId": "eip155:1",
"walletClientType": "metamask",
"connectorType": "injected"
}
response = requests.post(url_auth, headers=headers, data=json.dumps(data)).json()
token = response["token"]
print("[-] Token :"+ token)
time.sleep(3)
return token
def get_user_auth():
token = authenticate()
print("• Get UserAuth")
api_auth = "https://api.deform.cc/"
data = {
"operationName": "UserLogin",
"variables": {
"data": {
"externalAuthToken": token
}
},
"query": "mutation UserLogin($data: UserLoginInput!) {\n userLogin(data: $data)\n}"
}
response = requests.post(api_auth, headers=headers, data=json.dumps(data)).json()
datane = response['data']['userLogin']
print("[-] Bearer :"+ datane)
time.sleep(3)
return datane, api_auth
def check_id_campaign():
datane, api_auth = get_user_auth()
print("• Check Campaign")
headers2 = {
'Content-Type': 'application/json; charset=utf-8',
'Authorization': 'Bearer ' + datane
}
data = {
"operationName": "Campaign",
"variables": {
"campaignId": "0c5229f6-de83-43e2-a64c-7d4306b82084"
},
"query": (
"query Campaign($campaignId: String!) {\n"
" campaign(id: $campaignId) {\n"
" id\n"
" activities {\n"
" id\n"
" createdAt\n"
" updatedAt\n"
" startDateTimeAt\n"
" endDateTimeAt\n"
" title\n"
" description\n"
" type\n"
" identityType\n"
" recurringPeriod {\n"
" count\n"
" type\n"
" __typename\n"
" }\n"
" recurringMaxCount\n"
" properties\n"
" records {\n"
" id\n"
" status\n"
" createdAt\n"
" __typename\n"
" }\n"
" reward {\n"
" id\n"
" quantity\n"
" type\n"
" __typename\n"
" }\n"
" nft {\n"
" id\n"
" tokenId\n"
" name\n"
" description\n"
" image\n"
" properties\n"
" mintPrice\n"
" platformFee\n"
" maxSupply\n"
" maxMintCountPerAddress\n"
" nftContract {\n"
" id\n"
" address\n"
" type\n"
" chainId\n"
" __typename\n"
" }\n"
" __typename\n"
" }\n"
" __typename\n"
" }\n"
" standaloneActivities {\n"
" id\n"
" __typename\n"
" }\n"
" missions {\n"
" id\n"
" createdAt\n"
" updatedAt\n"
" startDateTimeAt\n"
" endDateTimeAt\n"
" title\n"
" description\n"
" coverPhotoUrl\n"
" recurringPeriod {\n"
" count\n"
" type\n"
" __typename\n"
" }\n"
" recurringMaxCount\n"
" properties\n"
" rewards {\n"
" id\n"
" quantity\n"
" type\n"
" __typename\n"
" }\n"
" records {\n"
" id\n"
" status\n"
" createdAt\n"
" __typename\n"
" }\n"
" activities {\n"
" id\n"
" __typename\n"
" }\n"
" __typename\n"
" }\n"
" __typename\n"
" }\n"
"}"
)
}
response = requests.post(api_auth, headers=headers2, data=json.dumps(data)).json()
activities = response['data']['campaign']['activities']
activity_list = [activity['title'] + ":" + activity['id'] for activity in activities]
time.sleep(3)
return activity_list, headers2, api_auth
def verify_Referral():
activity_list, headers2, api_auth = check_id_campaign()
print("• Verify Referral")
for activity in activity_list:
if "Campaign registration" in activity:
activity_id = activity.split(":")[1]
data = {
"operationName": "VerifyActivity",
"variables": {
"data": {
"activityId": activity_id,
"metadata": {
"referralCode": ref_code
}
}
},
"query": (
"mutation VerifyActivity($data: VerifyActivityInput!) {\n"
" verifyActivity(data: $data) {\n"
" record {\n"
" id\n"
" status\n"
" createdAt\n"
" __typename\n"
" }\n"
" __typename\n"
" }\n"
"}"
)
}
response = requests.post(api_auth, headers=headers2, data=json.dumps(data))
print(f"[-] {activity.split(':')[0]} => Done")
time.sleep(3)
return activity_list, headers2, api_auth
def verify_task():
activity_list, headers2, api_auth = verify_Referral()
print("\n• Verify Task")
ids_to_check = [
"Visit Cyber Staking Website",
"Learn more about Cyber Mainnet Staking",
"Check in to Staking Party every day"
]
for activity in activity_list:
for title in ids_to_check:
if title in activity:
activity_id = activity.split(":")[1]
data = {
"operationName": "VerifyActivity",
"variables": {
"data": {
"activityId": activity_id
}
},
"query": (
"mutation VerifyActivity($data: VerifyActivityInput!) {\n"
" verifyActivity(data: $data) {\n"
" record {\n"
" id\n"
" status\n"
" createdAt\n"
" __typename\n"
" }\n"
" __typename\n"
" }\n"
"}"
)
}
response = requests.post(api_auth, headers=headers2, data=json.dumps(data))
print(f"[-] {activity.split(':')[0]} => Done")
time.sleep(3)
if __name__ == "__main__":
print("\nCyber Mainnet - Auto Referral\n")
ref_code_file = input("Input list file => ")
with open(ref_code_file, "r") as file:
referral_codes = [line.strip() for line in file]
ref_total = input("How Many Referrals You Need => ")
for ref_code in referral_codes:
for i in range(int(ref_total)):
print(f"\nReferral Code : {ref_code} => Total : [{i}]")
verify_task()
time.sleep(3)