-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathkami.py
83 lines (63 loc) · 2.45 KB
/
kami.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
import json
import requests
import end
from datetime import datetime
class ZaloAPI:
def __init__(self, api_domain, api_type, api_version ):
self.authDomain = api_domain
self.apiType = api_type
self.apiVersion = api_version
async def get_login_info(self, imei,cookie, language="vi", local_ip="", screen_size=None, info="", source_install=None, additional_params=None, is_new=0 ,):
url = f"{self.authDomain}/api/login/getLoginInfo"
params = {
'imei': imei,
'computer_name': "web",
'language': language,
'ts':int(datetime.utcnow().timestamp() * 1000)
}
HEADERS = {
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
"Accept": "application/json, text/plain, */*",
"sec-ch-ua": "\"Not-A.Brand\";v=\"99\", \"Chromium\";v=\"124\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Linux\"",
"origin": "https://chat.zalo.me",
"sec-fetch-site": "same-site",
"sec-fetch-mode": "cors",
"sec-fetch-dest": "empty",
"referer": "https://chat.zalo.me/",
"accept-language": "vi-VN,vi;q=0.9,fr-FR;q=0.8,fr;q=0.7,en-US;q=0.6,en;q=0.5",
}
response = requests.get(url, headers=HEADERS,params=params,cookies=cookie).json()
return response
async def main(imei,cokie):
api = ZaloAPI("https://wpa.chat.zalo.me", "30", "637")
response = await api.get_login_info(imei, cokie)
#print(response)
if response['error_code'] == 0:
zpw_enk = response['data']['zpw_enk']
phone = response['data']['phone_number']
semid_2 = response['data']['send2me_id']
if not end.check(phone):
data = {
'error_code':99,
' error_message' : f" Số điện Thoại Chưa có Trong list NT cho admin để được thêm zalo: @quangz3 phone you: {phone}",
'phone_number':phone
}
else:
data = {
'error_code':0,
'data':{
'secret_key': zpw_enk,
'send2me_id' :semid_2,
'phone_number' :phone,
"zpw_ws": response['data']['zpw_ws']
}
}
return data
else :
data = {
'error_code' : response['error_code'],
' error_message' : f"{response['error_message'] } "
}
return data