Skip to content

whistle

whistle是基于 Nodejs 实现的跨平台的抓包调试工具。

安装

whistle 提供了Win 和 Mac 的客户端工具可以直接下载安装,也可以通过包安装工具安装(brew 或 AUR,其他平台没有),作为 Nodejs 实现也可以通过 npm 来安装:

Bash
brew install whistle

npm i -g whistle

证书安装

安装完成后想要真正抓包 https 流量还需要安装证书,对于客户端工具可以开启 HTTPS 请求捕获中下载 crt 证书文件:

Download crt

之后点击 rootCA.crt 文件根据弹出的证书安装对话框进行安装即可。也可以是用命令行工具来安装:

Bash
# 只支持 Windows 和 Mac
w2 ca --enable-https

Tips

对于 Linux 的比较复杂可以查考Https 根证书安装

手机安装证书

手机设置好代理后,在浏览器中输入 rootca.pro 或者扫描上面下载 crt 证书文件的二维码来安装。

Tips

IOS 还需要手动信任自定义根证书 设置 -> 通用 -> 关于本机 -> 证书信任设置(最下面) -> whistle.xxxxx

Tips

MacOS 能够安装 ISO APP 这个也是一个比较方便的抓包技巧。

正式使用

一旦安装成功,就可以通过运行 w2 start 来启用服务:

Bash
$ w2 start
[i] whistle@2.9.94 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/
       http://192.168.1.244:8899/
       Note: If all the above URLs are unable to access, check the firewall settings
             For help see https://github.com/avwo/whistle
[i] 2. set the HTTP proxy on your device with the above IP & PORT(8899)
[i] 3. use Chrome to visit http://local.whistlejs.com/ to get started

之后我们就可以通过设置代理为 127.0.0.1:8899 或者局域网中的其他主机(主要是手机)设置代理为 192.168.1.244:8899 即可。如果只是本机使用也可以运行:

Bash
w2 proxy

# 要关闭系统代理可以使用
w2 proxy 0

之后在运行 w2 服务的主机上访问 http://127.0.0.1:8899 或者 http://local.whistlejs.com 可以看到如下界面就说明能够正式使用了:

Whistle UI