吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1288|回复: 12
收起左侧

[讨论] 有没有大佬教教

[复制链接]
Kssssssss 发表于 2023-8-12 20:00
目标网址: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+sdr0uc0gtoZlyZFWBKPl7aQGHGnsDH2lTY4iw1sHiqXCHac8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aeRaoGGbifwQOikqRCZl5V2vqGY/NgYylW8+KAq/NtnwvFBWwftS8mRVZ13IsBVabiqyOc0bg2kcFeOPnGMhzqrBg7lDZ13zbqtAZstmp1+vAoY9ifLWPRSSSIYkEoICSWKTd3RDDE+H2/x9J7+T4FMWYZZdmopGB7kUYZE8OxAIaatjN8ogvcVygKohZUwaPLI9bGlXodW9qRObp/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。
请问大佬们该如何解决???

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

ChangHJ 发表于 2023-8-12 21:04
用python不是更好吗
 楼主| Kssssssss 发表于 2023-8-12 21:20
ChangHJ 发表于 2023-8-12 21:04
用python不是更好吗

我pip install pycryptodomex,一直报错,没找到解决办法。
py2.jpg
pyth1.jpg
ccber 发表于 2023-8-12 21:29
shiquda 发表于 2023-8-12 21:37
字符串base64解析好像有点问题,37行那个真的没问题吗
ljl9090 发表于 2023-8-12 21:57
function Decrypt(e,t,n) {
            var i = KEY
              , r = IV
            result = xa.AES.decrypt(e, i, {iv: r, mode: xa.mode.CBC,padding: xa.pad.Pkcs7}).toString(xa.enc.Utf8).toString();
            console.log(result)
            return getRealJsonData(xa.AES.decrypt(e, i, {iv: r, mode: xa.mode.CBC,padding: xa.pad.Pkcs7}).toString(xa.enc.Utf8).toString())
}

结果:
{"resCode":"SUCCESS","code":0,"route":null,"data":{"records":[{"id":1683672335712120833,"type":null,"modulesCode":"service_zxgs","title":"室内装修","citiesIdChineseTe
xt":"法拉盛","icon":"https://cn-minio.us168168.com/pro/images/us168/b680405587ca43048e6cc7140e8f7e341683672103154352128.jpg","address":"73 182nd st","hgooglePlay":nul
l},{"id":1409890952574418946,"type":null,"modulesCode":"service_zxgs","title": .......

对key 不做处理应该是可以出现结果的;另外getRealJsonData中的loopFindArrOrObj 方法没有,我觉得这个方法应该是可以用Python 实现的吧。

免费评分

参与人数 1吾爱币 +1 热心值 +1 收起 理由
Kssssssss + 1 + 1 热心回复!

查看全部评分

 楼主| Kssssssss 发表于 2023-8-12 22:20
shiquda 发表于 2023-8-12 21:37
字符串base64解析好像有点问题,37行那个真的没问题吗

就是e值传错了,谢谢
 楼主| Kssssssss 发表于 2023-8-12 22:21
shiquda 发表于 2023-8-12 21:37
字符串base64解析好像有点问题,37行那个真的没问题吗

有问题,就是e值传错了,谢谢
 楼主| Kssssssss 发表于 2023-8-12 22:23
ljl9090 发表于 2023-8-12 21:57
function Decrypt(e,t,n) {
            var i = KEY
              , r = IV

我接口找错了,所以e值也错了。初学者就是这么容易出错,感谢!
dggy8888 发表于 2023-8-12 22:58
一个小错误,要找半天,太难了啊
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2025-1-11 00:47

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表