-
Notifications
You must be signed in to change notification settings - Fork 13
/
getLocCookie.py
25 lines (22 loc) · 891 Bytes
/
getLocCookie.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
# encoding=utf8
#!/usr/bin/python
import js2py
import requests
import re
#pip install js2py
def getcookies():
url = 'https://www.hostloc.com/forum.php?mod=forumdisplay&fid=45&filter=author&orderby=dateline'
js=js2py.EvalJs()
headers = {"Referer": "http://www.baidu.com",'user-agent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.76 Mobile Safari/537.36'}
aesjs=requests.get("https://www.hostloc.com/aes.min.js",headers=headers,timeout=5).text
print aesjs
js.execute(aesjs)
getcookie=requests.get(url).text
#print getcookie
getcookie_script=re.findall("<script>(.*?)</script>",getcookie)
js.execute(getcookie_script[0].split("document")[0])
data=js.toHex(js.slowAES.decrypt(js.c, 2, js.a, js.b))
cookie="L7FW="+data
print cookie
return cookie
#print getcookies()