目标网址:https://www.us168.com/#/localServiceIndex?modulesCode=service_zxgs
目的是抓取页面数据。
js代码如下:[JavaScript] 纯文本查看 复制代码 const xa = require('crypto-js')
var KEY = xa.enc.Utf8.parse('c38cn38c372b48c4')
var IV = xa.enc.Utf8.parse('c38cn38c372b48c4')
function getRealJsonData(baseStr) {
if (baseStr && "string" == typeof baseStr) {
var jsonData = null;
try {
jsonData = JSON.parse(baseStr)
} catch (err) {
return null
}
var needReplaceStrs = []
, returnJson = (loopFindArrOrObj(jsonData, needReplaceStrs),
needReplaceStrs.forEach(function(replaceInfo) {
var matchArr = baseStr.match(eval('/"' + replaceInfo.key + '":[0-9]{15,}/')), str, replaceStr;
matchArr && (str = matchArr[0],
replaceStr = str.replace('"' + replaceInfo.key + '":', '"' + replaceInfo.key + '":"'),
replaceStr += '"',
baseStr = baseStr.replace(str, replaceStr))
}),
null);
try {
returnJson = JSON.parse(baseStr)
} catch (err) {
return null
}
return returnJson
}
}
function Decrypt(e,t,n) {
var i = KEY
, r = IV
, e = xa.enc.Hex.parse(e)
, e = xa.enc.Base64.stringify(e);
return getRealJsonData(xa.AES.decrypt(e, i, {iv: r, mode: xa.mode.CBC,padding: xa.pad.Pkcs7}).toString(xa.enc.Utf8).toString())
}
var ke = 'wWRspNAKxE8W1wf4++mMOLkiMnl1uYXm07LdnqFcVbF5K6P2i0MJOx6C6FYshlZZfWSIzWfgNCKaPemcSTQYm9LDblB44raxgRrjJIiVb2L4A0lxDXOTIE0YKJVi61vXa4LtFL9rl0w8lzskk6PLTU9eBMpvn+bi2+lSmQoh69I+QUqf0xbES0d7kt3L00+sdr0uc0gtoZlyZFWBKPl7aQGHGnsDH2lTY4iw1sHiqXCHac8BjCs8qrC0xNFM37mYqCIKAOZNAou/H1CrSGfF6w/QsYUVXn/hVZfsTxJURrjQVTE6+/Qyezujd/1JOmU5GEhWcc1FU9IEWJonxCzwu2kRlTWwL3OIewuHzpz/mbJW5j0mFnK8/W5T2eULlVPsIB8g7IzBoq4cq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GB7kUYZE8OxAIaatjN8ogvcVygKohZUwaPLI9bGlXodW9qRObp/SHVcQp7qOt8juV1VcATZ1oAcFuHk2E6MxRRqkYgygCNvsNI1cbj65HSww5shn05bRpDQ8QulpUS1Z/YzrXZeIQVOxbQ6wSSnVpMNohoj9k8w8FcZugoaDEBq5XbLSDOqp19koJo98YQUJ0tkRoPAc4hCaV5KWhEy/aw0vqM4CulwmVhVowMxB8O8XejTC8EsuNtdYwM9VcirmzNP61t88S/OWSQG+KRWUDOrcrhS5OZTTNBoeCF/jwpJ3mC120LXBEwhwNXbKCC+1y2rNKf4PcEaf7Tanl2sESsJ8I8E/VOelpA2fsojMp8xgsmRU1xCzkdLyk8LkpUBichpuTLwpKHhY5E8O6uNwSJGXwk7iVyAxIoRgbVMRxXdBA4aiFkLRIngEjsbQLrr9fGOBRsGpuGszifDE/QrwvKyJHqSaC6Hqh5O2SxP88zWy/0IDvPq8cjSD5t+P6wA8tUPGeGOxFsPyx/F0pFdP/tg7IfApR351jRw9sBeWJKMpe6tbyTv4Uh49WzKgxX8omlKyP0CA8lYUqlqQiYOKmKu1NWMNUhKlChDXMU/QYPF37zGe4rhitGryj3gtKFmCEdopIK1STkMYTbaqzng3Y+tGpVicS6Rzl29QTGvOsDqIlTYXKAAbQ5TNCMQaTVdQbF5LCnsHFfWXjDDODOBXmvU8GiIRxfTShM73aJaylEuPhuRTCzBsLAaRFUhoxcXr6GIRSzxwtEb4aCAfrGiRWh0NiRhy65sJYdblGaHiThBNuCWiFU3SmGiGjFUmcWMcWdinnP1Y2L0+ccvwtmuJEMX'
console.log(Decrypt(ke))
执行代码后抛出异常:Error: Malformed UTF-8 data。
请问大佬们该如何解决??? |