大刘的 iOS 自学笔记

使用whistle抓包

2022-06-27  本文已影响0人  大刘

Created by 大刘 liuxing8807@126.com

1. 安装Node

步骤:https://nodejs.org/en/

2. 安装whistle

npm install -g whistle

% npm install -g whistle
/usr/local/bin/whistle -> /usr/local/lib/node_modules/whistle/bin/whistle.js
/usr/local/bin/wproxy -> /usr/local/lib/node_modules/whistle/bin/whistle.js
/usr/local/bin/w2 -> /usr/local/lib/node_modules/whistle/bin/whistle.js
+ whistle@2.6.3
added 145 packages from 134 contributors in 8.084s


   ╭─────────────────────────────────────────────────────────────────╮
   │                                                                 │
   │      New patch version of npm available! 6.14.6 → 6.14.11       │
   │   Changelog: https://github.com/npm/cli/releases/tag/v6.14.11   │
   │                Run npm install -g npm to update!                │
   │                                                                 │
   ╰─────────────────────────────────────────────────────────────────╯

% node -v
v12.18.4

3. 启动whistle

w2 start        # 启动
w2 restart        # 重启
w2 stop         # 停止
w2 run             # 调试模式启动,主要用于查看whistle的异常及插件开发
% w2 start
[i] whistle@2.6.3 started
[i] 1. use your device to visit the following URL list, gets the IP of the URL you can access:
       http://127.0.0.1:8899/ # 在Chrome浏览器上输入此地址
       http://169.254.158.40:8899/
       http://192.168.33.99:8899/ # 在手机端配置WIFI代理
       Note: If all the above URLs are unable to access, check the firewall settings
             For help see https://github.com/avwo/whistle
[i] 2. configure your device to use whistle as its HTTP and HTTPS proxy on IP:8899
[i] 3. use Chrome to visit http://local.whistlejs.com/ to get started

4. 配置手机wifi代理

以上面w2 start 打印出来的IP示例,Android手机:

whistle_1.png

5. 测试

打开Chrome, 键入 http://127.0.0.1:8899/, 手机随便打开一个App,查看抓的包:

whistle_2.png

6. 证书配置

要抓到Https的包,需对Mac电脑和手机进行证书配置,即下载,安装并信任证书

whistle_3.png

注:

Mac电脑证书配置

对于Mac电脑,需要双击证书后,打开钥匙串,输入whistle找到证书并信息

whistle_4.png

iPhone手机证书配置

对于iPhone手机,可以参考官网, 如果调试iOS应用,iPhone和Mac都需要安装证书:
6.1 首先配置好HTTP代理:

whistle_5.png

6.2 现在的iPhone相机都有自动识别二维码功能,直接打开系统相机,扫描前面说到的官网提供的Https选项下面的二维码,按提示下载安装,然后在iPhone中: 设置 > 通用(General) > 描述文件 > 点击“安装”

whistle_6.png

6.3 安装好证书后再进入设置 > 通用 > 关于本机 > 证书信任设置 > 信息所安装的证书 即可

注意事项

如果出现手机扫描二维码无法下载的情况,这是由于必须先设置好HTTP的代理再扫描下载

上一篇下一篇

猜你喜欢

热点阅读