When using the web packet capture debugging proxy tool, we often encounter network requests that cannot capture command line tools or some clients, because these requests do not go through the system proxy. This brings some inconvenience to our development work. Is there any tool that can capture packet debugging requests of any client? Of course, this article will show how to use Whistle and Proxifier to capture packets and debug network requests from any client. It supports not only normal Web requests (HTTP, HTTPS, WebSocket), but also TCP requests.
Whistle and Proxifier:
Introduction of whistle
Whistle is a cross-platform Web packet capture and debugging agent based on Node implementation:
- Fully cross-platform, running on Mac, Windows, Linux/Unix desktops and command line systems
- Supports packet capture debugging HTTP, HTTPS, WebSocket, and Socket, and can modify all the contents of the request response
- Built-in WeinRE, support to view and modify the DOM structure of mobile web pages
- Built-in Log function, support automatic capture of all web page JS exceptions and console. XXX output various types of data
- All operations can be performed in the same way as configuring hosts
- Supports the extension function through the Node module plug-in
For more information about Whistle, visit Github at github.com/avwo/whistl… .
Proxifier profile
The Proxifier is a cross-platform proxy client that supports socks and HTTP. It intercepts all network requests from any client and forwards the requests to a specified proxy server. For details about the usage of the proxifier proxy tool, see the following table.
For details about Proxifier, visit www.proxifier.com
Proxifier is officially available only for Windows and Mac versions. There are many alternatives for other platforms such as Linux. You can search the web if necessary
The proxifier intercepts requests from any specified client and forwards them to Whistle through the HTTP proxy. This enables whistle to capture and debug requests from any client. The following describes how to install and configure Whistle and Proxifier:
Install configuration Whistle
-
Install Node(skip this step if you have already installed it) : You are advised to install Node of the latest version and go to the official website to install it.
-
Install Whistle (requires the latest version of Whistle (>=v1.10.6)) :
npm i -g whistle --registry=https://registry.npm.taobao.org Copy the code
Some companies may build their own images of NPM. You can install or set –registry= the company’s image with your own NPM command
-
Start the whistle:
w2 start Copy the code
Stop the whistle:
w2 stop Copy the code
Restart the whistle:
w2 restart Copy the code
Check out the Whistle version number:
w2 -V Copy the code
View all commands:
w2 --help Copy the code
The default whistle port is 8899. To change the whistle port, run the -p 8888 parameter, for example, w2 restart -p 8888
-
Install the Whistle root certificate
-
Enable capturing HTTPS requests
See README on Github to learn how to use whistle.
Install and configure proxifier
Proxifier is paid software with a 30-day free trial period. You can download and install it from the official website or use the software management interface of the PC Manager. There are also many free versions on the Internet.
Windows and Mac interfaces interact differently. The following describes how to configure the interfaces
-
Remove the automatic DNS Settings
-
Windows: Open the upper-left menu -> Configuration Files -> noun resolution -> Disable Automatic check DNS Settings -> Check host name resolution by proxy
-
Mac: DNS -> Remove the first checkbox -> check the second checkbox
-
-
Set up infinite loop connection detection
- Windows: Open the upper-left menu -> Profile -> Advanced -> Check
Infinite loop connection detection
- Mac: It will automatically detect, click OK when the dialog box pops up.
- Windows: Open the upper-left menu -> Profile -> Advanced -> Check
-
Adding a Proxy Server
-
Windows: In the upper left corner, choose Configuration Files > Proxy Server > Add proxy Service
Address: 127.0.0.1
Port: 8899(the default port number of Whistle, according to the actual port Settings of Whistle)
Protocol: HTTPS
-
Mac: Proxies -> Add
-
-
After the configuration is complete, open l.proxy. con in Chrome. Proxifier will display a dialog box indicating that a circular connection has been detected. Click OK.
-
Effect after configuration
Once the configuration is complete, you can happily capture any client request.
It is recommended that only the clients that want to capture packets be added to whistle through the Proxifier proxy rule
Possible problems
- Intercept all client requests on the back end, some clients may be using SSL pinning technology, resulting in certificate verification failures (e.g.
git push
), you can disable captured HTTPS requests for the corresponding domain nametunnel://github.com disable://capture
Or add the command line tool to the Proxifier rule and set the action:Direct
. - To view TCP request packets, you can set the TCP request packets
tunnel://host enable://inspect
(host
Is the domain name or IP displayed on the Network), so you can view the frame data of the TCP request through the right side of the Network ->Response->Frames. For details about debugging TCP(Socket), see:Debug websockets and Socket requests using Whistle.
For more questions, make ISSUE or PR.