Convert Figma logo to code with AI

avwo logowhistle

HTTP, HTTP2, HTTPS, Websocket debugging proxy

14,293
1,085
14,293
54

Top Related Projects

36,462

An interactive TLS-capable intercepting HTTP proxy for penetration testers and software developers.

A fully configurable http/https proxy in NodeJS

A free utility to help web developers watch and manipulate network traffic from their AJAX applications.

11,862

A fast,scalable,distributed game server framework for Node.js.

A full-featured http proxy for node.js

Quick Overview

Whistle is a cross-platform web debugging proxy tool based on Node.js. It provides a powerful set of features for capturing, inspecting, and modifying HTTP/HTTPS traffic between clients and servers, making it an invaluable tool for developers working on web applications and APIs.

Pros

  • Extensive feature set including traffic capture, modification, and simulation
  • User-friendly web interface for easy configuration and management
  • Supports both HTTP and HTTPS traffic interception
  • Highly extensible through plugins and custom rules

Cons

  • Steeper learning curve compared to some simpler proxy tools
  • Documentation can be challenging for non-Chinese speakers, as some parts are primarily in Chinese
  • May require additional setup for HTTPS interception on certain platforms

Getting Started

  1. Install Whistle globally using npm:

    npm install -g whistle
    
  2. Start Whistle:

    w2 start
    
  3. Configure your system or browser to use the Whistle proxy (default: 127.0.0.1:8899)

  4. Access the Whistle web interface at http://localhost:8899/

  5. Begin capturing and analyzing traffic by navigating to your target website or application

Competitor Comparisons

36,462

An interactive TLS-capable intercepting HTTP proxy for penetration testers and software developers.

Pros of mitmproxy

  • More powerful and flexible command-line interface
  • Better support for scripting and automation
  • Stronger focus on security testing and analysis

Cons of mitmproxy

  • Steeper learning curve for beginners
  • Less user-friendly GUI compared to Whistle
  • More complex setup process for certain scenarios

Code Comparison

mitmproxy:

def request(flow):
    if flow.request.host == "example.com":
        flow.request.headers["User-Agent"] = "Custom User Agent"

Whistle:

/example\.com/ reqHeaders://User-Agent/Custom User Agent/

Key Differences

  • mitmproxy is primarily a command-line tool with Python scripting capabilities, while Whistle offers a web-based interface and uses a rule-based system.
  • mitmproxy excels in advanced networking scenarios and security testing, whereas Whistle is more accessible for general web debugging and proxying tasks.
  • Whistle provides a more intuitive visual interface for managing rules and inspecting traffic, making it easier for non-technical users to get started.

Both tools are powerful in their own right, with mitmproxy offering more advanced features and flexibility, while Whistle provides a more user-friendly experience for common web debugging tasks.

A fully configurable http/https proxy in NodeJS

Pros of AnyProxy

  • Simpler setup and configuration process
  • Better documentation and examples for beginners
  • More lightweight and focused on core proxy functionality

Cons of AnyProxy

  • Less feature-rich compared to Whistle
  • Limited built-in UI for rule management and debugging
  • Fewer advanced features for complex scenarios

Code Comparison

AnyProxy:

module.exports = {
  summary: 'a rule to hack response',
  *beforeSendResponse(requestDetail, responseDetail) {
    if (requestDetail.url.indexOf('example.com') > -1) {
      const newResponse = responseDetail.response;
      newResponse.body += '-- modified by anyproxy --';
      return { response: newResponse };
    }
  },
};

Whistle:

exports.handleResponseRules = async (ctx) => {
  const { fullUrl, headers, body } = ctx.response;
  if (fullUrl.indexOf('example.com') > -1) {
    ctx.body = body + '-- modified by whistle --';
  }
};

Both projects offer proxy functionality with rule-based modifications. AnyProxy provides a more straightforward approach, while Whistle offers more advanced features and a built-in UI for rule management. AnyProxy might be better suited for simpler use cases, whereas Whistle excels in complex scenarios with its extensive plugin system and debugging tools.

A free utility to help web developers watch and manipulate network traffic from their AJAX applications.

Pros of BrowserMob Proxy

  • Java-based, integrates well with Selenium WebDriver for automated testing
  • Supports HAR (HTTP Archive) file generation for detailed network analysis
  • More mature project with longer development history

Cons of BrowserMob Proxy

  • Less active development and maintenance compared to Whistle
  • Limited built-in features for request/response manipulation
  • Steeper learning curve for non-Java developers

Code Comparison

BrowserMob Proxy (Java):

Proxy proxy = new BrowserMobProxyServer();
proxy.start(0);
Selenium driver = new ChromeDriver(proxy.seleniumProxy());
proxy.newHar("test");
driver.get("http://example.com");
Har har = proxy.getHar();

Whistle (JavaScript):

const whistle = require('whistle');
const w2 = new whistle();
w2.start({
  port: 8899,
  rules: 'example.com forward://127.0.0.1:8080'
});

Both projects serve as HTTP proxies for debugging and testing, but they cater to different ecosystems. BrowserMob Proxy is more focused on Java-based testing environments, while Whistle offers a more flexible, JavaScript-based approach with a wider range of built-in features for request/response manipulation. Whistle has a more active development community and frequent updates, making it potentially more suitable for modern web development workflows.

11,862

A fast,scalable,distributed game server framework for Node.js.

Pros of Pomelo

  • Designed specifically for game server development, offering scalable and real-time multiplayer game infrastructure
  • Supports multiple programming languages (JavaScript, TypeScript, C#) for game logic implementation
  • Provides built-in components for common game server features like channel management and session handling

Cons of Pomelo

  • Steeper learning curve due to its focus on game server architecture
  • Less versatile for general-purpose web development compared to Whistle
  • Requires more setup and configuration for non-game related projects

Code Comparison

Whistle (HTTP proxy configuration):

exports.handleRequest = async (ctx) => {
  if (ctx.fullUrl.includes('example.com')) {
    ctx.response.body = 'Intercepted';
  }
};

Pomelo (Game server route definition):

app.route('connector', function(session, msg, app) {
  var chatServers = app.getServersByType('chat');
  var res = dispatch(chatServers, session.get('rid'));
  return res.id;
});

Both projects serve different purposes, with Whistle focusing on HTTP debugging and Pomelo on game server development. Whistle offers a more straightforward approach for web developers, while Pomelo provides specialized tools for building scalable game backends.

A full-featured http proxy for node.js

Pros of node-http-proxy

  • Lightweight and focused solely on HTTP proxying
  • Easier to integrate into existing Node.js applications
  • More flexible for custom proxy implementations

Cons of node-http-proxy

  • Limited built-in features compared to Whistle
  • Requires more manual configuration for advanced use cases
  • Less comprehensive documentation and examples

Code Comparison

node-http-proxy:

const httpProxy = require('http-proxy');
const proxy = httpProxy.createProxyServer({});

proxy.on('proxyReq', function(proxyReq, req, res, options) {
  proxyReq.setHeader('X-Special-Proxy-Header', 'foobar');
});

Whistle:

exports.handleRequest = function(req, res) {
  req.headers['x-special-proxy-header'] = 'foobar';
  return true;
};

Summary

node-http-proxy is a lightweight and flexible HTTP proxy library for Node.js, ideal for developers who need to integrate proxying functionality into their existing applications. It offers more control over the proxying process but requires more manual configuration.

Whistle, on the other hand, is a more comprehensive proxy tool with a wider range of built-in features and a user-friendly interface. It's better suited for debugging and testing scenarios, offering a more complete out-of-the-box solution.

The choice between the two depends on the specific requirements of your project and the level of control you need over the proxying process.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

whistle logo

whistle

NPM version node version Test coverage npm download NPM count License

Mac 或 Windows 系统推荐使用客户端版本:https://github.com/avwo/whistle-client

Whistle 是基于 Node 实现的跨平台抓包调试工具,其主要特点:

  1. **完全跨平台**:支持 Mac、Windows 等桌面系统,且支持服务端等命令行系统
  2. 功能强大(理论上可以对请求做任意修改):
    • 支持作为 HTTP、HTTPS、SOCKS 代理及反向代理
    • 支持抓包及修改 HTTP、HTTPS、HTTP2、WebSocket、TCP 请求
    • 支持重放及构造 HTTP、HTTPS、HTTP2、WebSocket、TCP 请求
    • 支持设置上游代理、PAC 脚本、Hosts、延迟(限速)请求响应等
    • 支持查看远程页面的 console 日志及 DOM 节点
    • 支持用 Node 开发插件扩展功能,也可以作为独立 npm 包引用
  3. 操作简单:
    • 直接通过浏览器查看抓包、修改请求
    • 所有修改操作都可以通过配置方式实现(类似系统 Hosts),并支持分组管理
    • 项目可以自带代理规则配置并一键设置到本地 Whistle 代理,也可以通过定制插件简化操作

一键安装

已安装 brew 的 PC,可以省略以下 1、2 步骤,直接通过以下方式一键安装:brew install whistle && w2 start --init

  1. 安装 Node(建议安装**最新的 LTS 版本**,如已安装忽略此步骤):https://nodejs.org/
  2. 一键安装,在命令行执行以下命令:
    npm i -g whistle && w2 start --init
    

    上述命令会先全局安装 Whistle 的 npm 包后,启动 Whistle 并设置系统全局代理,以及安装系统根证书,目前一键安装只支持 Mac & Windows 系统,其它系统按照下面 手动安装 的方式操作。

    如果安装过程时报错 Bad CPU type in executable,在命令执行 arch -x86_64 zsh 再重新执行一键安装命令。

  3. 一键安装过程中注意事项:
    • Mac 需要两次输入开机密码或指纹验证

      输入开机密码

      输入指纹
    • Windows 需要最后点击 “是(Y)” 确认

      点击 是(Y)

如果需要自定义代理配置或根证书(如设置其它代理,根证书或代理白名单等)可以通过以下命令实现:

  1. w2 proxy 设置系统全局代理:https://wproxy.org/whistle/proxy.html
  2. w2 ca 设置系统根证书:https://wproxy.org/whistle/proxy.html

也可以用下面 手动安装 方式。

手动安装

非 Mac & Windows 系统或一键安装失败可以按下面方式设置代理和安装根证书:

  1. 设置代理:https://wproxy.org/whistle/install.html
  2. 安装根证书:https://wproxy.org/whistle/webui/https.html

快速上手

安装成功后,用 Chrome 打开链接 http://local.whistlejs.com 即可看到 Whistle 的抓包配置界面:

抓包界面 image

详细用法参见:Whistle 帮助文档

通过 SwitchyOmega 设置代理

安装 SwitchyOmega

打开 Chrome 扩展商店进行安装 https://chrome.google.com/webstore/detail/proxy-switchyomega/padekgcemlokbadohgkifijomclgjgif

配置 SwitchyOmega

全局代理如果会影响到某些客户端的请求(客户端设置了 ssl pinning),也可以使用 Chrome 插件设置代理(只对 Chrome 生效):

可以通过 w2 proxy off 关闭全局代理

  1. 设置 Whistle 代理

  2. 选择 Whistle 代理

    image

安全设置

  1. 通过启动参数给管理界面设置用户名密码:w2 restart -n yourusername -w yourpassword
  2. 通过插件给经过代理的请求设置用户名密码:https://github.com/whistle-plugins/whistle.proxyauth

License

MIT

NPM DownloadsLast 30 Days