believeyrc / whistle

HTTP, HTTPS, Websocket debugging proxy

Home Page:https://avwo.github.io/whistle/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

whistle logo

whistle

node version build status Test coverage npm download NPM count David deps License

建议大家升级到最新版本(>= v1.5.5),否则在Node8上运行时会出现无法访问的情况:#60

如果出现HTTPS的问题(#44),升级Node到 v6 及以上版本,更新whistle到最新版本,通过 w2 restart -A (注意后面加 -A)启动生成新的更证书,再安装下根证书即可

注意:在iOS上安装根证书时,需要先关闭https拦截,否则将显示安装失败

其它问题也可以加QQ群讨论: 462558941

whistle基于Node实现的跨平台web调试代理工具,类似的工具有Windows平台上的Fiddler,主要用于查看、修改HTTP、HTTPS、Websocket的请求、响应,也可以作为HTTP代理服务器使用,不同于Fiddler通过断点修改请求响应的方式,whistle采用的是类似配置系统hosts的方式,一切操作都可以通过配置实现,支持域名、路径、正则表达式、通配符、通配路径等多种匹配方式,且可以通过Node模块扩展功能

whistle的安装请参见: whistle帮助文档

快速入门推荐看这篇文章: whistle工具全程入门

基本功能

基本功能

完整功能请参见: whistle帮助文档

配置模式

传统hosts的配置模式:

# 单个host
ip hostname

# 组合host
ip hostname1 hostname2 ... hostnameN

# 例如
127.0.0.1 www.example.com
127.0.0.1 a.example.com b.example.com c.example.com

whistle的配置模式:

# 单个操作
pattern operator-uri
# 如果pattern和operator-uri不同时为域名或路径的一种组合,位置可以调换
operator-uri pattern

# 组合模式
pattern operator-uri1 operator-uri2 ... operator-uriN
# pattern1和operator-uri不同时为域名或路径的一种组合,可以如下配置
operator-uri pattern1 pattern2 ... patternN

其中,pattern可以为:

  1. 域名:www.test.com(所有该域名下的请求都会匹配operator-uri)
  2. 路径:http://www.test.com/xxx(http://www.test.com/xxx及其子路径的请求都会匹配operator-uri),或不加协议protocol://www.test.com/xxx,protocol可以为http、https、ws、wss(http://www.test.com/xxx及其子路径的请求都会匹配operator-uri)
  3. 正则:/^https?:\/\/([^\/]+)\/xxx/(http(s)://host:port/xxx及其子路径的请求都会匹配operator-uri,且在operator-uri中可以通过$1, $2, ..., $9获取url里面的子匹配)
  4. 精确:在原来路径前面加精确匹配符$,即:$url(可以带协议$http://www.test.com/xxx,也可以不带协议$www.test.com)
  5. 通配符:http://*.test.com*.test.com*.test/abc$*.test.com
  6. 通配路径: ~/abchttps://~/abc$~/$http://~/

详细内容请参见: 配置模式匹配方式

operator-uri由上述基本功能抽象成的形如protocol://ruleValue的URI,whistle会根据匹配到的operator-uri的protocolruleValue修改请求或响应,具体实现过程请参见whistle帮助文档

例如: ​

# 修改www.example.com的响应cors
www.example.com resCors://*
# 或
resCors://* www.example.com

# 同时修改多个自定域名或路径
resCors://* /example\.com/ a.test.com b.test.com
# 修改www.test.com的带端口host、referer和响应的cors
www.test.com 127.0.0.1:8080 referer://http://www.example.com resCors://*

完整功能参见: whistle帮助文档

Network

Network

Rules

Rules

Values

Values

完整功能请参见: whistle帮助文档

License

MIT

About

HTTP, HTTPS, Websocket debugging proxy

https://avwo.github.io/whistle/

License:MIT License


Languages

Language:JavaScript 99.5%Language:HTML 0.5%