爬虫准备前工作

1.Pycham的下载

网址:PyCharm: The only Python IDE you need

2.Python的下载

网址:python.org(python3.9版本之后都可以)

3.node.js的下载

网址:Node.js --- 在任何地方运行 JavaScript(版本使用18就可以)

4.curl的使用

网址:Convert curl commands to code(复制网址的curl写简单的request)

5.Python代码中运行js代码

python 复制代码
import subprocess
from functools import partial

subprocess.Popen = partial(subprocess.Popen, encoding="utf-8")

import execjs


with open("007 js逆向解密、加密数据.js", encoding="utf-8") as f:
    jsCode = f.read()
js_compile = execjs.compile(jsCode)
sign = js_compile.call("d", json_data)

6.Proxy补环境监听

python 复制代码
// proxy代理监控器
delete __dirname
delete __filename

top = self = window = global

document = {}
location = {}
navigator = {}
history = {}
screen = {}

function getEnv(proxy_array) {
    for (var i = 0; i < proxy_array.length; i++) {
        handler = `{\n
            get: function(target, property, receiver) {\n
                   console.log('方法:get','    对象:${proxy_array[i]}','    属性:',property,'    属性类型:',typeof property,'    属性值类型:',typeof target[property]);
                   return target[property];
            },
            set: function(target, property, value, receiver){\n
                    console.log('方法:set','    对象:${proxy_array[i]}','    属性:',property,'    属性类型:',typeof property,'    属性值类型:',typeof target[property]);
                    return Reflect.set(...arguments);
            }
        }`
        eval(`
            try {
                ${proxy_array[i]};
                ${proxy_array[i]} = new Proxy(${proxy_array[i]}, ${handler});
            } catch (e) {
                ${proxy_array[i]} = {};
                ${proxy_array[i]} = new Proxy(${proxy_array[i]}, ${handler});
            }
        `)
    }
}

proxy_array = ['window', 'document','location', 'navigator', 'history', 'screen']
getEnv(proxy_array)

7. webpack细节

开头进行补环境 window = global (先运行,看哪些环境需要进行补)
在加载函数中,注释初始化,一般在加载器函数中(最后一行)的进行注释 例如: // o(o.s = 0)
全局要调用加载器函数(看加载器函数中调用的是哪个对象就调用哪个全局变量) 例如: o.e/o.c/o.r(这时候我们就可以这样调用window.zhang = o)
打上执行模块日志,也在加载器函数中 (console.log("t:::",t))
使用webpack的步骤

(1) 定位入口确认使用了webpack对象
(2) 断点加载器,一般通过刷新页面触发
(3) 注意这是一个单文件的还是多文件的webpack
(4) 将加载器文件拷贝到本地,做以下三件事
-- 全局化
-- 日志
-- 观察初始化

(5) 测试加载器的调用,根据模块日志补充mod

8.js入口定位查找方法

第1知识点:关于json请求体

第2知识点:关于精准请求(如何排除干扰请求)
第3知识点:入口定位
一、关键字方法
(1) 方法关键字
encrypt :加密入口
decrypt :解密入口
JSON.stringify:加密入口
JSON.parse:解密入口
(2) key关键字
(3) headers关键字 xxx()
(4) 拦截器关键字
interceptors.request.use
interceptors.response.use
(5) 路径关键字

第4知识点:断点与断点调试

普通断点
XHR断点
条件断点
日志断点
脚本断点

相关推荐
Buke..2 小时前
【APP 逆向】哔哩哔哩 sign 参数逆向(下):OLLVM 混淆还原 sign 算法
java·javascript·爬虫·python·算法
Buke..3 小时前
【APP 逆向】哔哩哔哩 sign 参数逆向(上):Frida 反调试绕过与 unidbg 调用
java·开发语言·爬虫·python·安卓
归去来 兮7 小时前
Python爬虫爬取数据案例
开发语言·爬虫·python
大鹏说大话1 天前
从爬虫到决策引擎:大数据下自媒体如何用Python挖掘用户痛点
开发语言·爬虫·python
Minner-Scrapy1 天前
Scrapy 2.17 源码解析:Scheduler 调度器与磁盘/内存双队列
java·爬虫·python·scrapy·网络爬虫·twisted
陈皮波比茶1 天前
Python项目实战-网络机器人(爬虫)
开发语言·网络·爬虫·python·机器人
不叫猫先生1 天前
2026 Web Scraping 实战:页面改 class 就归零?用 Bright Data 搭稳定的 Agent 爬虫
爬虫·agent
tang777891 天前
Scrapy框架动态IP自动轮换集成配置教程
爬虫·tcp/ip·scrapy·架构·爬虫代理·动态ip
深蓝电商API1 天前
ECC 加密简介
爬虫·ecc
傻啦嘿哟2 天前
英雄联盟皮肤爬虫:爬取全皮肤价格与特效,做比价工具
java·c++·爬虫