This repository has been archived by the owner on Dec 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathNumbusterAPI.py
342 lines (292 loc) · 18.5 KB
/
NumbusterAPI.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
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
import requests
import signatures
import time
requests.adapters.DEFAULT_RETRIES = 500
class Numbuster:
def __init__(self,access_token=None):
self.access_token = access_token
self.api_url = 'https://api.numbuster.com/api/'
self.headers = {'Host': 'api.numbuster.com',
'User-Agent': 'okhttp/3.12.1',#'okhttp/3.12.1',
'Accept-Encoding': 'gzip',
'Connection': 'keep-alive'}
def v6_comment_list_my(self,offset:int,limit:int):
timestamp = signatures.get_timestamp()
cnonce = signatures.get_cnonce()
signature = signatures.signature_v6_comment_list_my(self.access_token,cnonce,limit,offset,timestamp)
url = self.api_url+f'v6/comment/list/my?offset={offset}&limit={limit}×tamp={timestamp}&signature={signature}&cnonce={cnonce}&access_token={self.access_token}'
data = requests.get(url,headers=self.headers)
return data.json()
def v6_comment_list(self,phone:str,offset:int,limit:int):
timestamp = signatures.get_timestamp()
cnonce = signatures.get_cnonce()
signature = signatures.signature_v6_comment_list(self.access_token,cnonce,limit,offset,phone,timestamp)
url = self.api_url+f'v6/comment/list?phone={phone}&offset={offset}&limit={limit}×tamp={timestamp}&signature={signature}&cnonce={cnonce}&access_token={self.access_token}'
data = requests.get(url,headers=self.headers)
return data.json()
def v6_comment_delete(self,phone:str):
timestamp = signatures.get_timestamp()
cnonce = signatures.get_cnonce()
signature = signatures.signature_v6_comment_delete(self.access_token,cnonce,phone,timestamp)
url = self.api_url+f'v6/comment/delete?phone={phone}×tamp={timestamp}&signature={signature}&cnonce={cnonce}&access_token={self.access_token}'
data = requests.get(url,headers=self.headers)
return data.json()
def v6_old_phone(self,phone,locale='ru'):
timestamp = signatures.get_timestamp()
cnonce = signatures.get_cnonce()
signature = signatures.signature_v6_old_phone(phone,self.access_token,cnonce,timestamp,locale)
url = self.api_url+f'v6/old/phone/{phone}?access_token={self.access_token}&locale={locale}×tamp={timestamp}&signature={signature}&cnonce={cnonce}'
data = requests.get(url,headers=self.headers)
return data.json()
def v6_notice_delete(self,phone):
timestamp = signatures.get_timestamp()
cnonce = signatures.get_cnonce()
signature = signatures.signature_v6_notice_delete(self.access_token,cnonce,phone,timestamp)
url = self.api_url+f'v6/notice/delete?phone={phone}×tamp={timestamp}&signature={signature}&cnonce={cnonce}&access_token={self.access_token}'
data = requests.post(url,headers=self.headers)
return data.json()
def v6_old_sms(self,phone,locale='ru'):
timestamp = signatures.get_timestamp()
cnonce = signatures.get_cnonce()
signature = signatures.signature_v6_old_sms(phone,self.access_token,cnonce,timestamp,locale)
url = self.api_url+f'v6/old/sms/{phone}?access_token={self.access_token}&locale={locale}×tamp={timestamp}&signature={signature}&cnonce={cnonce}'
data = requests.get(url,headers=self.headers)
return data.json()
def v6_report_comment(self,comment_id:int,report_text:str):
url = self.api_url+f'v6/report/comment?comment_id={comment_id}&report_text={report_text}&access_token={self.access_token}'
data = requests.post(url,headers=self.headers)
return data.json()
def v6_numcy_subscription_comment_renewal(self,comment_id:int):
timestamp = signatures.get_timestamp()
cnonce = signatures.get_cnonce()
signature = signatures.signature_v6_numcy_subscription_comment_renewal(self.access_token,cnonce,comment_id,timestamp)
url = self.api_url+f'v6/numcy/subscription/comment/renewal?comment_id={comment_id}×tamp={timestamp}&signature={signature}&cnonce={cnonce}&access_token={self.access_token}'
data = requests.post(url,headers=self.headers)
return data.json()
def v6_auth_get(self,platform='Android',lang='en'):
#Allows to get misterious code
timestamp = signatures.get_timestamp()
cnonce = signatures.get_cnonce()
signature = signatures.signature_v6_auth_get(cnonce,timestamp,lang,platform)
url = self.api_url+f'v6/auth/get?platform={platform}&lang={lang}×tamp={timestamp}&signature={signature}&cnonce={cnonce}'
data = requests.get(url,headers=self.headers)
return data.json()
def v6_auth_precheck(self,code:str,phone:str):
headers = self.headers.copy()
headers['Content-Type'] = 'application/x-www-form-urlencoded'
timestamp = signatures.get_timestamp()
cnonce = signatures.get_cnonce()
signature = signatures.signature_v6_auth_precheck(cnonce,code,phone,timestamp)
url = self.api_url+f'v6/auth/precheck?timestamp={timestamp}&signature={signature}&cnonce={cnonce}'
data = requests.post(url,headers=headers,data=bytes(f'code={code}&phone={phone}','utf-8'))
return data.json()
def v6_old_search(self,phone:str,locale='ru'):
timestamp = signatures.get_timestamp()
cnonce = signatures.get_cnonce()
signature = signatures.signature_v6_old_search(phone,self.access_token,cnonce,timestamp,locale)
url = self.api_url+f'v6/old/search/{phone}?access_token={self.access_token}&locale={locale}×tamp={timestamp}&signature={signature}&cnonce={cnonce}'
data = requests.get(url,headers=self.headers)
return data.json()
def v6_numcy_subscription_coment_cancel(self,comment_id:int):
timestamp = signatures.get_timestamp()
cnonce = signatures.get_cnonce()
signature = signatures.signature_v6_numcy_subscription_comment_cancel(self.access_token,cnonce,comment_id,timestamp)
url = self.api_url+f'v6/numcy/subscription/comment/cancel?comment_id={comment_id}×tamp={timestamp}&signature={signature}&cnonce={cnonce}&access_token={self.access_token}'
data = requests.post(url,headers=self.headers)
return data.json()
def v6_dailyquest_get(self):
timestamp = signatures.get_timestamp()
cnonce = signatures.get_cnonce()
signature = signatures.signature_v6_dailyquest_get(self.access_token,cnonce,timestamp)
url = self.api_url+f'v6/dailyquest/get?timestamp={timestamp}&signature={signature}&cnonce={cnonce}&access_token={self.access_token}'
data = requests.get(url,headers=self.headers)
return data.json()
def v6_auth_facebook(self,facebook_token,code):
timestamp = signatures.get_timestamp()
cnonce = signatures.get_cnonce()
signature = signatures.signature_v6_auth_facebook(cnonce,code,facebook_token,timestamp)
url = self.api_url+f'v6/auth/facebook?facebook_token={facebook_token}&code={code}×tamp={timestamp}&signature={signature}&cnonce={cnonce}'
data = requests.post(url,headers=self.headers)
return data.json()
def v6_old_profiles_by_phone(self,phone:str,locale='ru'):
timestamp = signatures.get_timestamp()
cnonce = signatures.get_cnonce()
signature = signatures.signature_v6_old_profiles_by_phone(phone,self.access_token,cnonce,timestamp,locale)
url = self.api_url+f'v6/old/profiles/by_phone/{phone}?access_token={self.access_token}&locale={locale}×tamp={timestamp}&signature={signature}&cnonce={cnonce}'
data = requests.get(url,headers=self.headers)
return data.json()
def v6_numcy_balance(self):
timestamp = signatures.get_timestamp()
cnonce = signatures.get_cnonce()
signature = signatures.signature_v6_numcy_balance(self.access_token,cnonce,timestamp)
url = self.api_url+f'v6/numcy/balance?timestamp={timestamp}&signature={signature}&cnonce={cnonce}&access_token={self.access_token}'
data = requests.get(url,headers=self.headers)
return data.json()
def v6_numcy_subcription_comment_settings(self):
timestamp = signatures.get_timestamp()
cnonce = signatures.get_cnonce()
signature = signatures.signature_v6_numcy_subscription_comment_settings(self.access_token,cnonce,timestamp)
url = self.api_url+f'v6/numcy/subscription/comment/settings?timestamp={timestamp}&signature={signature}&cnonce={cnonce}&access_token={self.access_token}'
data = requests.get(url,headers=self.headers)
return data.json()
def v6_comment_add(self,phone:str,text:str):
text_u = signatures.to_url(text)
timestamp = signatures.get_timestamp()
cnonce = signatures.get_cnonce()
signature = signatures.signature_v6_comment_add(self.access_token,cnonce,phone,text_u,timestimp)
url = self.api_url+f'v6/comment/add?phone={phone}&text={text}×time={timestamp}&signature={signature}&cnonce={cnonce}&access_token={self.access_token}'
data = requests.post(url,headers=self.headers)
return data.json()
def v6_auth_agreement(self,phone:str):
headers = self.headers.copy()
headers['Content-Type'] = 'application/x-www-form-urlencoded'
timestamp = signatures.get_timestamp()
cnonce = signatures.get_cnonce()
signature = signatures.signature_v6_auth_agreement(cnonce,phone,timestamp)
url = self.api_url+f'v6/auth/agreement?timestamp={timestamp}&signature={signature}&cnonce={cnonce}'
data = requests.post(url,headers=headers,data=bytes(f'phone={phone}','utf-8'))
return data.json()
def v6_comment_edit(self,phone:str,text:str):
text_u = signatures.to_url(text)
timestamp = signatures.get_timestamp()
cnonce = signatures.get_cnonce()
signature = signatures.signature_v6_comment_edit(self.access_token,cnonce,phone,text_u,timestamp)
url = self.api_url+f'v6/comment/edit?phone={phone}&text={text}×tamp={timestamp}&signature={signature}&cnonce={cnonce}&access_token={self.access_token}'
data = requests.post(url,headers=self.headers)
return data.json()
def v6_dailyquest_calendar(self):
timestamp = signatures.get_timestamp()
cnonce = signatures.get_cnonce()
signature = signatures.signature_v6_dailyquest_calendar(self.access_token,cnonce,timestamp)
url = self.api_url+f'v6/dailyquest/calendar?timestamp={timestamp}&signature={signature}&cnonce={cnonce}&access_token={self.access_token}'
data = requests.get(url,headers=self.headers)
return data.json()
def v6_notice_add(self,phone,text:str):
text_u = signatures.to_url(text)
timestamp = signatures.get_timestamp()
cnonce = signatures.get_cnonce()
signature = signatures.signature_v6_notice_add(self.access_token,cnonce,phone,text_u,timestamp)
url = self.api_url+f'v6/notice/add?phone={phone}&text={text}×time={timestamp}&signature={signature}&cnonce={cnonce}&access_token={self.access_token}'
data = requests.post(url,headers=self.headers)
return data.json()
def v6_auth_agreement_code(self,code:str):
#code from v6/auth/get
headers = self.headers.copy()
headers['Content-Type'] = 'application/x-www-form-urlencoded'
timestamp = signatures.get_timestamp()
cnonce = signatures.get_cnonce()
signature = signatures.signature_v6_auth_agreement_code(cnonce,code,timestamp)
url = self.api_url+f'v6/auth/agreement_code?×tamp={timestamp}&signature={signature}&cnonce={cnonce}'
data = requests.post(url,headers=headers,data=bytes(f'code={code}','utf-8'))
return data.json()
def v6_notice_edit(self,phone:str,text:str):
text_u = signatures.to_url(text)
timestamp = signatures.get_timestamp()
cnonce = signatures.get_cnonce()
signature = signatures.signature_v6_notice_edit(self.access_token,cnonce,phone,text_u,timestamp)
url = self.api_url+f'v6/notice/edit?phone={phone}&text={text}×tamp={timestamp}&signature={signature}&cnonce={cnonce}&access_token={self.access_token}'
data = requests.post(url,headers=self.headers)
return data.json()
def v6_auth_check(self,code:str):
timestamp = signatures.get_timestamp()
cnonce = signatures.get_cnonce()
signature = signatures.signature_v6_auth_check(cnonce,code,timestamp)
url = self.api_url+f'v6/auth/check?code={code}×tamp={timestamp}&signature={signature}&cnonce={cnonce}'
data = requests.get(url,headers=self.headers)
return data.json()
def another_bans(self,profileId:int):
#old4a27f7a4025447ee5560a49bc5bcde34/bans
url = self.api_url+f'old4a27f7a4025447ee5560a49bc5bcde34/bans?profileId={profileId}&access_token={self.access_token}'
data = requests.post(url,headers=self.headers)
return data.json()
def another_profiles_id_phones(self,id:int,phone=str):
url = self.api_url+f'old4a27f7a4025447ee5560a49bc5bcde34/profiles/{id}/phones?phone={phone}&access_token={self.access_token}'
data = requests.post(url,headers=self.headers)
return data.json()
def another_profiles_id_phones_confirm(self,id:int,phone:str,code:str):
url = self.api_url+f'old4a27f7a4025447ee5560a49bc5bcde34/profiles/{id}/phones/confirm?phone={phone}&code={code}&access_token={self.access_token}'
data = requests.post(url,headers=self.headers)
return data.json()
def another_profiles(self,phone:str):
#can be used without access_token
headers = self.headers.copy()
headers['Content-Type'] = 'application/x-www-form-urlencoded'
url = self.api_url+f'old4a27f7a4025447ee5560a49bc5bcde34/profiles'
data = requests.post(url,headers=headers,data=bytes(f'phone={phone}','utf-8'))
return data.json()
def another_profiles_confirm(self,phone:str,code:str):
#access_token in response
#code from phone
#can be used without access_token
headers = self.headers.copy()
headers['Content-Type'] = 'application/x-www-form-urlencoded'
url = self.api_url+f'old4a27f7a4025447ee5560a49bc5bcde34/profiles/confirm'
data = requests.post(url,headers=headers,data=bytes(f'phone={phone}&code={code}','utf-8'))
return data.json()
def another_profiles_without_code(self,phone:str):
#can be used without access_token
headers = self.headers.copy()
headers['Content-Type'] = 'application/x-www-form-urlencoded'
url = self.api_url+f'old4a27f7a4025447ee5560a49bc5bcde34/profiles/without-code'
data = requests.post(url,headers=headers,data=bytes(f'phone={phone}','utf-8'))
return data.json()
def another_ping(self,device_uid='ca971311-cdc0-4662-98ac-e301c9ddf0a1',device_imei='200856862726018',device_os='Android',device_token='0',locale='en_US',device_version='61100'):
dt = f'device%5uid%5D={device_uid}&device%5Bimei%5D={device_imei}&device%5Bos%5D={device_os}&device%5BdeviceToken%5D={device_token}&device%5Blocale%5D={locale}&device%5Bversion%5D={device_version}'
headers = self.headers.copy()
headers['Content-Type'] = 'application/x-www-form-urlencoded'
url = self.api_url+f'old4a27f7a4025447ee5560a49bc5bcde34/ping?access_token={self.access_token}'
data = requests.post(url,headers=headers,data=bytes(dt,'utf-8'))
return data.json()
def another_profiles_callme(self,phone:str,device_uid='ca971311-cdc0-4662-98ac-e301c9ddf0a1',device_imei='200856862726018',device_os='Android',device_token='0',locale='en_US',device_version='61100'):
dt = f'phone={phone}&device%5uid%5D={device_uid}&device%5Bimei%5D={device_imei}&device%5Bos%5D={device_os}&device%5BdeviceToken%5D={device_token}&device%5Blocale%5D={locale}&device%5Bversion%5D={device_version}'
url = self.api_url+f'old4a27f7a4025447ee5560a49bc5bcde34/profiles/callme'
headers = self.headers.copy()
headers['Content-Type'] = 'application/x-www-form-urlencoded'
data = requests.post(url,headers=headers,data=bytes(dt,'utf-8'))
return data.json()
def v2_ping(self,version = '61100'):
headers = self.headers.copy()
headers['Content-Type'] = 'application/x-www-form-urlencoded'
url = self.api_url+f'v2/ping?access_token={self.access_token}'
data = requests.post(url,headers=headers,data=bytes(f'package_name=com.numbuster.android&version={version}&check=false','utf-8'))
return data.json()
def v2_contacts_sync(self):
headers = self.headers.copy()
headers['Content-Type'] = 'application/json; charset=UTF-8'
url = self.api_url+f'v2/contacts/sync?access_token={self.access_token}'
data = requests.post(url,headers=headers,data='[]')
return data.json()
def v7_main_load(self):
timestamp = signatures.get_timestamp()
cnonce = signatures.get_cnonce()
signature = signatures.signature_v7_main_load(self.access_token,cnonce,timestamp)
url = self.api_url+f'v7/main/load?access_token={self.access_token}&cnonce={cnonce}×tamp={timestamp}&signature={signature}'
data = requests.get(url,headers=self.headers)
return data.json()
def request_sms_code(self,phonenumber:str):
#self.another_ping()
#self.v2_ping()
data = api.another_profiles(phonenumber)
code = self.v6_auth_get()['data']['code']
self.v6_auth_agreement_code(code)
#dt = self.another_profiles_callme(phonenumber)
#dt = self.v6_auth_check(code)
#print(dt)
time.sleep(3)
dt = self.v6_auth_precheck(code,phonenumber)
print(dt)
self.another_profiles_without_code(phonenumber)
self.another_profiles(phonenumber)
def send_sms_code(self,phonenumber:str,code:str):
self.access_token = api.another_profiles_confirm(phonenumber,code)['access_token']
self.another_ping()
#self.v2_ping()
#self.v6_auth_agreement(phonenumber)
self.v2_contacts_sync()
if __name__ == '__main__':
api = Numbuster()
api.request_sms_code('79916714306')
code = input('Code: ')
api.send_sms_code('79916714306',code)
print(api.access_token)
print(api.v6_old_phone('79916714306'))