-
Notifications
You must be signed in to change notification settings - Fork 15
/
req_check.py
47 lines (34 loc) · 951 Bytes
/
req_check.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
"""用于检查服务器状态,比如有多少人在监听服务器、推送者有哪些等等
"""
import rsa
import utils
import global_var
check_ip = ''
clean_ip = ''
name = 'bbbn' # 用户名没必要改
key = 'V_F<Nv)!WeK]irWY' # 检测 key 是否存在以及相关信息
with open(f'{global_var.KEY_PATH}/super_admin_privkey.pem', 'rb') as f:
admin_privkey = rsa.PrivateKey.load_pkcs1(f.read())
dict_signature = utils.make_signature(
name,
admin_privkey,
need_name=True)
data = {}
if key:
naive_hashed_key = utils.naive_hash(key)
data['naive_hashed_key'] = naive_hashed_key
if check_ip:
data['check_ip'] = check_ip
if clean_ip:
data['clean_ip'] = clean_ip
data = {
'code': 0,
'type': 'raffle',
'data': data,
'verification': dict_signature,
}
json_rsp = utils.request_json(
'GET',
f'{global_var.URL}/check',
json=data)
print('JSON结果:', json_rsp)