parent
d8e5692a68
commit
0c907cf246
5 changed files with 54 additions and 194 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@ |
||||
const {jsdomFromText, browser} = require("sdenv");
const {Script} = require("node:vm");
const fs = require("node:fs");
var baseUrl = 'https://dppt.hubei.chinatax.gov.cn:8443'
// TODO 需要文件内的 meta name="_y_ds" content 标签内容
var html = fs.readFileSync('./invoice-business.html', 'utf8').toString();
let js = fs.readFileSync('./chunk-npjg4qgmmrfrjl3r.js', 'utf8').toString();
// TODO:用户登陆token 测试时需要替换
var loginCookieStr = "oauth2_referer=dppt.hubei.chinatax.gov.cn; dzfp-ssotoken=558e20b0555441b6a723333ffd085253; SSO_SECURITY_CHECK_TOKEN=94a79332b58645359caca9381056c45e; c_time=12; lzkqow39189=f0c370b651604dc59b381360b69f2808; DTSwUOYx7MiWN=8df0aa147df27872b37be9efbcdfed1106b18489437dc5c53cae011c8c711192; lzkqow38189=1726977103530; MKls83gqduGS=dd85896203ee8ae2b020201604f5ec10842e240c4b23ea7e958edce788dfd18dc591c01ffe9bba1fd84cd93ba12560e3"
async function get_los(url, param) {
console.time('js执行时长')
const [jsDom, cookieJar] = jsdomFromText({
url: `${baseUrl}/invoice-query/invoice-query`,
referrer: baseUrl,
userAgent: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36',
contentType: "text/html",
runScripts: "outside-only", // runScripts: 'dangerously'/'outside-only'
})
// 加载dom
let dom = await jsDom(html);
const window = dom.window
// 设置 cookie
for (let cookie of loginCookieStr.trim().split("; ")) {
cookieJar.setCookieSync(cookie, baseUrl);
}
browser(window, 'chrome');
// 加载js
let script = new Script(js);
let internalVMContext = dom.getInternalVMContext();
// 执行 js
script.runInContext(internalVMContext, {timeout: 1000});
if (window.$dunm.$byno) {
window.$dunm.$byno();
}
let los = window[window["_d_ts"]](url, param);
console.log('js执行完成,返回结果 ',los )
// 关闭
dom.window.close()
console.timeEnd('js执行时长')
var getPublicKey = await fetch(`${baseUrl + los.hurl}`, {
"headers": {
"accept": "*/*",
"accept-language": "zh-CN,zh;q=0.9",
"cache-control": "no-cache",
"content-type": "text/plain;charset=UTF-8",
"lzkqow23819": `${los.hd}`,
// "pragma": "no-cache",
// "sec-ch-ua": "\"Not)A;Brand\";v=\"99\", \"Google Chrome\";v=\"127\", \"Chromium\";v=\"127\"",
// "sec-ch-ua-mobile": "?0",
// "sec-ch-ua-platform": "\"Linux\"",
// "sec-fetch-dest": "empty",
// "sec-fetch-mode": "cors",
// "sec-fetch-site": "same-origin",
// "sso_security_check_token": "94a79332b58645359caca9381056c45e",
"x-requested-with": "XMLHttpRequest",
"cookie": cookieJar.getCookieStringSync(baseUrl),
// "Referer": "https://dppt.hubei.chinatax.gov.cn:8443/invoice-business?ruuid=1726970597058",
"Referrer-Policy": "strict-origin-when-cross-origin"
},
"body": "",
"method": "POST"
});
console.log('测试getPublicKey请求', await getPublicKey.json())
}
var url = `/sqlz/cssSecurity/v1/getPublicKey?t=${new Date().getTime()}`
// TODO:如果有 param 加密后得到 enParam
var enParam = {}
get_los(url, enParam);
|
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue