站wasm加密逆向)
網(wǎng)站Scrape | Movie https://spa14.scrape.center/抓包有一個(gè)sign參數(shù)加密復(fù)制到Convert curl commands to Python這個(gè)網(wǎng)站獲得基礎(chǔ)代碼import requests headers { Accept: application/json, text/plain, */*, Accept-Language: zh-CN,zh;q0.9,en;q0.8,en-GB;q0.7,en-US;q0.6, Connection: keep-alive, DNT: 1, Referer: https://spa14.scrape.center/, Sec-Fetch-Dest: empty, Sec-Fetch-Mode: cors, Sec-Fetch-Site: same-origin, User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36 Edg/151.0.0.0, sec-ch-ua: NotA?Brand;v99, Microsoft Edge;v151, Chromium;v151, sec-ch-ua-mobile: ?0, sec-ch-ua-platform: Windows, } params { limit: 10, offset: 0, sign: 595360780, } response requests.get(https://spa14.scrape.center/api/movie/, paramsparams, headersheaders) print(response.json())定位查找sign參數(shù)的加密的位置1、全局搜索2、堆棧查找首先點(diǎn)擊進(jìn)入源代碼打上一個(gè)斷點(diǎn)刷新頁面到此處已經(jīng)發(fā)現(xiàn)sign的值但是沒有發(fā)現(xiàn)定義sign繼續(xù)找繼續(xù)找在此處找到定義跳轉(zhuǎn)到一個(gè)看不懂的地方用豆包解決一下最后的結(jié)果import requests import time import json import sys # 解決windows控制臺(tái)GBK打印報(bào)錯(cuò)放在代碼最開頭 if sys.platform win32: sys.stdout.reconfigure(encodingutf-8) headers { Accept: application/json, text/plain, */*, Accept-Language: zh-CN,zh;q0.9,en;q0.8,en-GB;q0.7,en-US;q0.6, Connection: keep-alive, DNT: 1, Referer: https://spa14.scrape.center/, Sec-Fetch-Dest: empty, Sec-Fetch-Mode: cors, Sec-Fetch-Site: same-origin, User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36 Edg/151.0.0.0, sec-ch-ua: NotA?Brand;v99, Microsoft Edge;v151, Chromium;v151, sec-ch-ua-mobile: ?0, sec-ch-ua-platform: Windows, } def wasm_encrypt(var0: int, var1: int) - int: div int(var1 / 3) res var0 div 16358 return res limit 10 # 循環(huán)翻頁page從1~9 for page in range(1, 10): # 【重要每一頁循環(huán)內(nèi)重新計(jì)算n、time_sec、sign e】 offset (page - 1) * limit n offset time_sec round(time.time()) e wasm_encrypt(n, time_sec) params { limit: limit, offset: offset, sign: e, } response requests.get(https://spa14.scrape.center/api/movie/, paramsparams, headersheaders) print(f page {page} offset{offset} sign{e} ) # 方案1loads之后用json.dumps打印不會(huì)報(bào)gbk錯(cuò)誤 ensure_asciiFalse輸出中文 data response.json() print(json.dumps(data, ensure_asciiFalse, indent2))