mirror of
https://github.com/luzhisheng/js_reverse.git
synced 2025-04-20 03:59:57 +08:00
猿人学第12题-js-base64
This commit is contained in:
parent
b760a6b353
commit
969ef2c78b
BIN
img/73.png
Normal file
BIN
img/73.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
21
猿人学第12题-js-base64/readme.md
Normal file
21
猿人学第12题-js-base64/readme.md
Normal file
@ -0,0 +1,21 @@
|
||||
## 任务:抓取这5页的数字,计算加和并提交结果
|
||||
|
||||
https://match.yuanrenxue.com/match/12
|
||||
|
||||
查看请求地址
|
||||
|
||||
https://match.yuanrenxue.com/api/match/12?page=1&m=eXVhbnJlbnh1ZTE%3D
|
||||
|
||||
其中m是加密参数
|
||||
|
||||
m=eXVhbnJlbnh1ZTE%3D
|
||||
|
||||
打断点调试
|
||||
|
||||

|
||||
|
||||
"m": btoa('yuanrenxue' + window.page)
|
||||
|
||||
很简单,直接上python代码
|
||||
|
||||
[最后代码实现](实例12.py "js代码4")
|
29
猿人学第12题-js-base64/实例12.py
Normal file
29
猿人学第12题-js-base64/实例12.py
Normal file
@ -0,0 +1,29 @@
|
||||
import requests
|
||||
import base64
|
||||
import json
|
||||
|
||||
|
||||
def get_num():
|
||||
|
||||
num = 0
|
||||
for i in range(1, 6):
|
||||
con_str = 'yuanrenxue' + str(i)
|
||||
ba_str = base64.b64encode(con_str.encode()).decode()
|
||||
url = f"https://match.yuanrenxue.com/api/match/12?page={i}&m={ba_str}"
|
||||
Headers = {
|
||||
"user-agent": "yuanrenxue.project",
|
||||
"cookie": "Hm_lvt_c99546cf032aaa5a679230de9a95c7db=1648698333,1648863299; "
|
||||
"Hm_lvt_9bcbda9cbf86757998a2339a0437208e=1648718340,1648863297; "
|
||||
"no-alert3=true; m=155; tk=7332741390523673465; sessionid=ac0xs5o2sopkirmvude3epvr8uzo8w66;"
|
||||
" Hm_lpvt_9bcbda9cbf86757998a2339a0437208e=1649313675; "
|
||||
"Hm_lpvt_c99546cf032aaa5a679230de9a95c7db=1649316025"
|
||||
}
|
||||
res = requests.get(url=url, headers=Headers)
|
||||
res_dict = json.loads(res.text)
|
||||
data = res_dict.get('data')
|
||||
for i in data:
|
||||
num += i['value']
|
||||
print(num)
|
||||
|
||||
|
||||
get_num()
|
Loading…
x
Reference in New Issue
Block a user