Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

爬虫研究分析-响应结果加密 #1

Open
ggymm opened this issue Aug 5, 2021 · 1 comment
Open

爬虫研究分析-响应结果加密 #1

ggymm opened this issue Aug 5, 2021 · 1 comment
Labels
爬虫 爬虫技术学习和研究

Comments

@ggymm
Copy link
Owner

ggymm commented Aug 5, 2021

目标网站

某磁力连接网站

目标

获取如图信息

image

遇到问题

  1. 数据是js加载的

  2. 数据是加密(?)的

image_1

那么就需要进行解密

解密数据

格式化代码

关键JS文件是压缩过的,无法进行调试。需要格式化后才可以进行调试

首先找到关键JS文件

image_2

点击代码左下角进行格式化

格式化后会生成一个新的JS文件,这个时候刷新页面,在新的JS里面打的断点就会起作用

开始调试

首先查找接口看是否可以获取线索

image_3

显然,基本没有什么多余的信息可以获取

那么换一种思路,从接口获取数据到渲染页面一定会有从接口返回数据中读取列表信息的过程

image_4

经过查看接口返回值,发现列表信息对应的Key为hits

所以搜索hits(注意搜索时选择不忽略大小写)

image_5

如图所示,从请求接口返回值中获取列表数据

只需要关注这一句

l.adapter.data.pushAll(a)

接下来搜索adapter.data

image_6

一共7个结果,经过查看除了调用clear()就是调用length。只有这里最可疑

接下来走了一些弯路,我先后去搜索了wt,We,Ue这几个函数,发现这些方法实现的逻辑是构造虚拟dom。渲染页面。没有我关注的解密数据过程

直到我发现这一行代码

image_7

原来如此,解密方法写在String的原型中,最后搜索到解密方法如下

String.prototype.decrypt = function() {
    var e = this.valueOf();
    if (0 < this.length) {
        for (var t = [], n = 0; n < e.length; n++)
            t[n] = 202033 ^ e.charCodeAt(n);
        e = String.fromCharCode.apply(null, t)
    }
    return e
}

python版本

if __name__ == '__main__':
    s = "誨曑嬲誨曑䑙菷"
    t = ''
    for c in s:
        t += chr((202033 ^ ord(c)) % 65536)
    print(t)

 # 输出结果
 # 龙珠(七龙珠)全集 

结语

最后分析的结果并没有用上

@ggymm ggymm added the 爬虫 爬虫技术学习和研究 label Aug 5, 2021
@dreamofstudy
Copy link

大佬牛批!!!!!

@ggymm ggymm changed the title 记一次爬取数据过程 爬虫(返回数据加密) Aug 9, 2021
@ggymm ggymm changed the title 爬虫(返回数据加密) 爬虫(结果数据加密) Aug 9, 2021
@ggymm ggymm changed the title 爬虫(结果数据加密) 爬虫(Response加密) Aug 9, 2021
@ggymm ggymm changed the title 爬虫(Response加密) 爬虫研究分析-响应结果加密 Aug 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
爬虫 爬虫技术学习和研究
Projects
None yet
Development

No branches or pull requests

2 participants