Initialize encryption and JavaScript reverse-engineering study repository
Document the project structure and setup while excluding local dependencies and IDE settings. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
41
非对称加密-2026-08-31/实战案例-中国观鸟记录中心/python调用.py
Normal file
41
非对称加密-2026-08-31/实战案例-中国观鸟记录中心/python调用.py
Normal file
@@ -0,0 +1,41 @@
|
||||
import time
|
||||
|
||||
import requests
|
||||
import execjs
|
||||
|
||||
|
||||
with open("参数加密.js", "r", encoding="utf-8") as f:
|
||||
code_js = f.read()
|
||||
|
||||
code = execjs.compile(code_js)
|
||||
for page in range(1, 2):
|
||||
temp_params = code.call("beforeSend", page)
|
||||
|
||||
headers = {
|
||||
"Accept": "application/json, text/javascript, */*; q=0.01",
|
||||
"Accept-Language": "zh-CN,zh;q=0.9",
|
||||
"Connection": "keep-alive",
|
||||
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
|
||||
"Origin": "https://www.birdreport.cn",
|
||||
"Referer": "https://www.birdreport.cn/",
|
||||
"Sec-Fetch-Dest": "empty",
|
||||
"Sec-Fetch-Mode": "cors",
|
||||
"Sec-Fetch-Site": "same-site",
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/152.0.0.0 Safari/537.36",
|
||||
"requestId": str(temp_params["requestId"]),
|
||||
"sec-ch-ua": "\"Chromium\";v=\"152\", \"Not?A_Brand\";v=\"24\", \"Google Chrome\";v=\"152\"",
|
||||
"sec-ch-ua-mobile": "?0",
|
||||
"sec-ch-ua-platform": "\"Windows\"",
|
||||
"sign": str(temp_params["sign"]),
|
||||
"timestamp": str(temp_params["timestamp"])
|
||||
}
|
||||
|
||||
enc_data = temp_params["data"]
|
||||
url = 'https://api.birdreport.cn/front/activity/search'
|
||||
response = requests.post(url, headers=headers, data=enc_data)
|
||||
response_json = response.json()
|
||||
result = code.call("aes_decrypt", response_json["data"])
|
||||
|
||||
print(result)
|
||||
print(response)
|
||||
time.sleep(1)
|
||||
51
非对称加密-2026-08-31/实战案例-中国观鸟记录中心/参数加密.js
Normal file
51
非对称加密-2026-08-31/实战案例-中国观鸟记录中心/参数加密.js
Normal file
@@ -0,0 +1,51 @@
|
||||
const JSEncrypt = require("jsencrypt");
|
||||
var crypto_js = require("crypto-js");
|
||||
|
||||
const encrypt = new JSEncrypt();
|
||||
var paramPublicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvxXa98E1uWXnBzXkS2yHUfnBM6n3PCwLdfIox03T91joBvjtoDqiQ5x3tTOfpHs3LtiqMMEafls6b0YWtgB1dse1W5m+FpeusVkCOkQxB4SZDH6tuerIknnmB/Hsq5wgEkIvO5Pff9biig6AyoAkdWpSek/1/B7zYIepYY0lxKQIDAQAB";
|
||||
encrypt.setPublicKey(paramPublicKey);
|
||||
|
||||
function MD5(text) {
|
||||
return crypto_js.MD5(text).toString();
|
||||
}
|
||||
|
||||
function getUuid() {
|
||||
var s = [];
|
||||
var hexDigits = "0123456789abcdef";
|
||||
for (var i = 0; i < 32; i++) {
|
||||
s[i] = hexDigits.substr(Math.floor(Math.random() * 16), 1)
|
||||
}
|
||||
s[14] = "4";
|
||||
s[19] = hexDigits.substr(s[19] & 3 | 8, 1);
|
||||
s[8] = s[13] = s[18] = s[23];
|
||||
var uuid = s.join("");
|
||||
return uuid
|
||||
}
|
||||
|
||||
function beforeSend(page) {
|
||||
var timestamp = Date.parse(new Date);
|
||||
var requestId = getUuid();
|
||||
|
||||
var data = `{"limit":"20","page":"${page}"}`
|
||||
const sign = MD5(data + requestId + timestamp)
|
||||
return {
|
||||
timestamp: timestamp,
|
||||
requestId: requestId,
|
||||
sign: sign,
|
||||
data: encrypt.encrypt(data)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function aes_decrypt(encrypt_data) {
|
||||
var key = crypto_js.enc.Utf8.parse("C8EB5514AF5ADDB94B2207B08C66601C");
|
||||
var iv = crypto_js.enc.Utf8.parse("55DD79C6F04E1A67");
|
||||
var decrypted = crypto_js.AES.decrypt(encrypt_data, key, {
|
||||
iv: iv,
|
||||
mode: crypto_js.mode.CBC,
|
||||
padding: crypto_js.pad.Pkcs7,
|
||||
})
|
||||
return decrypted.toString(crypto_js.enc.Utf8);
|
||||
}
|
||||
|
||||
// console.log(beforeSend(1));
|
||||
9
非对称加密-2026-08-31/实战案例-中国观鸟记录中心/混淆代码.js
Normal file
9
非对称加密-2026-08-31/实战案例-中国观鸟记录中心/混淆代码.js
Normal file
@@ -0,0 +1,9 @@
|
||||
_0x48989b["prototype"]['decode'] = function (_0x291626) {
|
||||
var _0x3c6fa1 = CryptoJS['enc']["Utf8"]["parse"]("C8EB5514AF5ADDB94B2207B08C66601C")
|
||||
, _0x3ec027 = CryptoJS["enc"]["Utf8"]["parse"]("55DD79C6F04E1A67");
|
||||
return CryptoJS["AES"]["decrypt"](_0x291626, _0x3c6fa1, {
|
||||
'iv': _0x3ec027,
|
||||
'mode': CryptoJS["mode"]['CBC'],
|
||||
'padding': CryptoJS['pad']["Pkcs7"]
|
||||
})['toString'](CryptoJS['enc']['Utf8']);
|
||||
}
|
||||
Reference in New Issue
Block a user