Fiddler captures actual combat, completely open the interface test (1)


foreword

Fiddler is a free Windows platform capture tool, powerful and easy to use. Fiddler packet capture is based on the man-in-the-middle proxy mode.

Fiddler will automatically set the system proxy when it starts. When a program such as Chrome browser accesses a webpage or sends an HTTP request, it will be automatically sent to the server through Fiddler, so all HTTP requests sent by all current PCs can be viewed in Fiddler.

The main features of Fiddler are as follows:
can capture request data, view Raw format/form format/JSON/XML format;
can intercept and modify requests;
more powerful filters;
can capture requests sent by Postman/interface scripts for easy debugging
; Capture mobile phone request;

Fiddler main interface

The main interface of Fiddler is divided into menu bar, toolbar, request list, quick command bar, monitoring panel and status bar.

D1

The Fiddler menu bar includes File (file), Edit (edit), Rules (rules), Tools (tools), View (display) and Help (help).

The Fiddler toolbar includes WinConfig (Windows configuration), Replay (replay), cleanup, Go (intercept and release), Stream (stream), Decode (decode), Keep: All sessions (request session retention), Any Process (grab process), Find (find), Save (save), Browse (browser selection) and Clear Cache (clear cache).

The left side of the main area is the request list, also known as the session list (an interaction between the client and the server is called a session process). Different icons are used in the request list to distinguish different types of session types.

Common session types are as follows:

D1

D2

D3

Note: The above table uses the session icon of the new version of Fiddler. Icons such as HTML format, XML format, CSS, script, and picture are slightly different from the old version.

Request icons can help us quickly identify various types of requests or responses. GET method requests display different icons according to different response data types, and methods such as POST display corresponding icons according to the request method type.

For a request with a relatively large amount of data, it will be displayed as an upload and download icon during the request and response process. When a breakpoint is used to intercept the request or response, the upload and download icon will be displayed in a paused style.

Request packet capture

Grabbing requests is one of the main functions of Fiddler. Fiddler will automatically set the system proxy when it starts, so as long as Fiddler is opened, it can normally grab the HTTP requests of the current PC. To capture HTTPS requests or mobile requests, corresponding configurations must be made.

Grab the HTTPS request on the PC side

Open a browser and visit https://www.baidu.com/ to view the requests captured in Fiddler

D4

When the certificate is not set and installed, the captured HTTPS request is displayed as an HTTP CONNECT request with a lock icon, and is forwarded to port 443 of the corresponding website.

To capture HTTPS requests, you need to check Capture HTTPS Connections and Decrypt HTTPS Data in the settings. The method of operation is to click Tools in the menu bar, select Options, and switch to the HTTPS panel.

D5

As shown above, check Capture HTTPS CONNECTs (capture HTTPS connections), Decrypt HTTPS traffic (decrypt HTTPS data) and Ignore server certificate errors (unsafe) (ignore server certificate errors). Since we need to use the free certificate provided by Fiddler, it is possible that the server may report a certificate error, just ignore it.

Install the HTTPS certificate provided by Fiddler. The installation method is very simple. After starting Fiddler, open the browser and visit http://localhost:8888/.

D6

Click the link FiddlerRoot certificate at the bottom of the page. After the download is complete, double-click to open it, click Install Certificate, and install it with the default options in the next step. After the installation is complete, a prompt will pop up to indicate that the import is successful.

Restart Fiddler and visit https://www.baidu.com/ again.

D7

At this time, HTTPS type requests can be captured. Click the request, click the Inspectors panel on the right, the upper part is the request information, and the lower part is the response information. The puppet response information has been encoded, click Responsebody is encoded.Click to decode. Decode view, select Raw format, you can view the source code of the returned Baidu web page.

Note: If you cannot catch the packet, you can check whether the Filter filter is checked.

Forcibly closing Fiddler will cause the proxy to fail to cancel normally, but Fiddler is closed and cannot access the Internet. At this time, reopen Fiddler, and then close it normally once to automatically cancel the proxy.

Capture mobile requests

To capture the HTTP or HTTPS request sent by the App on the mobile phone, you need to manually set the network proxy on the mobile phone as the Fiddler proxy service address, even if the mobile phone accesses the Internet through the Fiddler proxy, it can be captured.

First of all, the mobile phone and the computer must be in the same local area network, such as the same Wi-Fi network to access the Internet. Start Fiddler on the computer (automatically start the proxy service, the default port number is 8888), use ipconfig or ifconfig to check the IP address of the computer, such as 192.168.1.3, then the address of the Fiddler proxy service is 192.168.1.3:8888.

In Fiddler, click Tools on the menu bar, select the Options option, switch to the Connections tab, and check the line Allow remote computers to connect to allow remote devices to connect to the Fiddler proxy service.

D8

Open the mobile phone settings, find the connected Wi-Fi network, select advanced (iPhone, click the circle i icon behind the Wi-Fi network), configure the proxy, select manual, and configure the IP address and port number as the computer IP address and 8888 respectively. Click Save (store).

D9

Use a mobile browser to access http://computer IP address: 8888 (it is recommended to use the mobile phone's native browser), and the Fiddler Echo Service page will be displayed. Also click FiddlerRoot certificate to download and install the certificate.

After installing the certificate, the iPhone needs to trust the certificate. In the phone settings, click General, click About This Machine, click Certificate Trust Settings, set to trust the DO_NOT_TRUST_FiddlerRoot certificate, and return.

Keep Fiddler open at this time, just use the mobile browser to browse the website or use the App to request, if a warning pops up that the HTTPS certificate is not trusted, just ignore it.

Note: After setting the proxy, because the mobile phone needs to go online through the Fiddler proxy, if Fiddler is turned off, the mobile phone will not be able to connect to the Internet. When not capturing packets, you can cancel the configuration agent in the phone settings.

The following is the most complete software test engineer learning knowledge architecture system diagram in 2023 that I compiled

1. From entry to mastery of Python programming

Please add a picture description

2. Interface automation project actual combat

Please add a picture description

3. Actual Combat of Web Automation Project

Please add a picture description

4. Actual Combat of App Automation Project

Please add a picture description

5. Resume of first-tier manufacturers

Please add a picture description

6. Test and develop DevOps system

Please add a picture description

7. Commonly used automated testing tools

Please add a picture description

Eight, JMeter performance test

Please add a picture description

9. Summary (little surprise at the end)

Don't be afraid of failures and setbacks, because they are the stepping stones to success. Only by working hard can you create your own brilliance. Believe in your own abilities and persist in pursuing your dreams, you will find infinite possibilities and achievements waiting for you.

Every effort is an accumulation, every persistence is a progress, don't stop, don't give up the pursuit, only struggle can you surpass yourself and create your own brilliant life. Believe in yourself, go ahead, you will be able to succeed.

Life is like a battlefield, and struggle is the only criterion. Don't be afraid of difficulties, don't stop pursuing, only by making unremitting efforts can you create your own brilliance. Believe in your own ability and go forward bravely, you will achieve an extraordinary and magnificent life.

Guess you like

Origin blog.csdn.net/csdnchengxi/article/details/131854170