-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMain.py
74 lines (65 loc) · 1.74 KB
/
Main.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
from flask import Flask, request
import kami
import asyncio
import end
app = Flask(__name__)
@app.route('/zalo', methods=['GET'])
def get_cookie():
all_cookies = request.headers.get('Cookie')
cookie_dict = {}
if all_cookies:
cookies = all_cookies.split("; ")
for cookie in cookies:
key, value = cookie.split("=", 1)
cookie_dict[key] = value
imei = request.args.get('imei')
if imei == None or cookie_dict == None:
data = {
'error_code': 403,
' error_message': "Khong tim thay imei và cookie của ban vui long kiem tra lai"
}
return data
data = asyncio.run(kami.main(imei, cookie_dict))
#print(data)
if data['error_code'] == 0 or data['error_code'] == 99:
try:
phone = data['phone_number']
except:
phone = data['data']['phone_number']
with open(f'data/{phone}.txt', 'w') as file:
z = f"imei={imei} \ncookie={cookie_dict}"
file.write(z + '\n')
return data
@app.route('/add', methods=['GET'])
def add():
key = request.args.get('key')
phone = request.args.get('phone')
if key !="kami":
data = {
'msg': " Làm Gì Đó bạn ???"
}
else:
z = end.add(phone)
data = {
'msg': z
}
return data
@app.route('/rem', methods=['GET'])
def rem():
key = request.args.get('key')
phone = request.args.get('phone')
if key !="kami":
data = {
'msg': " Làm Gì Đó bạn ???"
}
else:
z = end.rem(phone)
data = {
'msg': z
}
return data
@app.route('/kami', methods=['GET'])
def remz():
return end.phones
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)