-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathyhshCookie.py
More file actions
52 lines (42 loc) · 1.3 KB
/
yhshCookie.py
File metadata and controls
52 lines (42 loc) · 1.3 KB
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
import json
import os
import requests
url = '127.0.0.1:5700'
def getToken():
if os.path.isfile('/ql/data/config/auth.json'):
with open('/ql/data/config/auth.json', 'r') as f:
config = json.load(f)
return 'Bearer ' + config['token']
if __name__ == '__main__':
newUrl = f"http://{url}/open/envs"
headers = {
'Authorization': getToken(),
'Content-Type': 'application/json'
}
yhsh = []
sec = requests.session()
sec.verify = False
sec.trust_env = False
rj = sec.get(newUrl, headers=headers).json()
if rj['code'] == 200:
for x in rj['data']:
if x['name'] == 'yhsh_cookies':
yhsh.append(f"{x['value']}#{x['remarks']}")
pass
newUrl = f"http://{url}/open/envs"
headers = {
'Authorization': getToken(),
'Content-Type': 'application/json'
}
pupu = []
sec = requests.session()
sec.verify = False
sec.trust_env = False
rj = sec.get(newUrl, headers=headers).json()
if rj['code'] == 200:
for x in rj['data']:
if x['name'] == 'pupu_cookies':
pupu.append(f"{x['value']}#{x['remarks']}")
pass
with open('/ql/data/scripts/yang7758258_ohhh_QL-Script/pupuCookie.txt', 'w') as f:
f.write('\n'.join(pupu))