Fiddler tutorial (GO)

Source: Internet
Author: User
Tags clear screen fiddler2
 

Fiddler is one of the most powerful and useful web debugging tools. It records HTTP and HTTPS requests from all clients and servers, allowing you to monitor, set breakpoints, and even modify input and output data. using Fiddler is helpful for both development and testing.

Reading directory

  1. Basic Introduction to Fiddler
  2. How fiddler works
  3. Other similar tools
  4. How does fiddler capture Firefox sessions?
  5. Use the fiddler plug-in Firefox
  6. How does fiddler capture HTTPS sessions?
  7. Basic interface of Fiddler
  8. Statistics view of Fiddler
  9. Use of quickexec command line
  10. Set a breakpoint modification request in Fiddler
  11. Set a breakpoint to modify response in Fiddler
  12. Create autoresponder rules in Fiddler
  13. How to filter sessions in Fiddler
  14. Session comparison in Fiddler
  15. Encoding gadgets provided by fiddler
  16. Query sessions in Fiddler
  17. Saving sessions in Fiddler
  18. Script System of Fiddler
  19. How to Use fiddler when debugging a website in
  20. Response is garbled
Basic Introduction to Fiddler

Official website of Fiddler: www.fiddler2.com

The official website of Fiddler provides a large number of help documents and video tutorials, which are the best materials to learn about Fiddler.

Fiddler is one of the most powerful and useful web debugging tools. It records HTTP and HTTPS requests from all clients and servers, allowing you to monitor, set breakpoints, and even modify input and output data, fiddler contains a powerful event script-based subsystem that can be used.. Net Language extension

The more you understand the HTTP protocol, the more you will be able to master the use of Fiddler. The more you use Fiddler, the more you will be able to understand the HTTP protocol.

Fiddler is a useful tool for developers and testers.

How fiddler works

Fiddler works as a proxy Web server. It uses the proxy address 127.0.0.1, Port: 8888. when fiddler automatically sets a proxy, it will automatically log out of the proxy when it exits, so that it will not affect other programs. However, if the fiddler exits abnormally, the webpage cannot be accessed because the fiddler is not automatically logged out. The solution is to restart Fiddler.

 

Other similar tools

Similar Tools include httpwatch, firebug, and Wireshark.

 

How does fiddler capture Firefox sessions?

Data packets of any program that supports HTTP proxy can be sniffed by Fiddler. the running mechanism of Fiddler is actually the HTTP proxy that listens to port 8888 on the local machine. When fiddler2 is started, the default IE proxy is set to 127.0.0.1: 8888, while other browsers need to be set manually. Therefore, you can change the Firefox proxy to 127.0.0.1: 8888 to listen to the data.

Set proxy through the following steps on Firefox

Click Tools> options. In the Options dialog box, click Advanced Tab> network tab> setting.

 

Install the fiddler plug-in Firefox

It is troublesome to modify the proxy in Firefox. You do not need to remove the proxy when using Fiddler. Trouble

We recommend that you use the fiddler hook plug-in Firefox, so that you can easily use Fiddler to obtain the request and response in Firefox.

After you install Fiddler, you have installed the fiddler hook plug-in. You need to enable this plug-in Firefox.
Open Firefox tools-> add ons-> extensions and start fiddlerhook.

 

 

How does fiddler capture HTTPS sessions?

By default, Fiddler does not capture HTTPS sessions. You need to enable fiddler tool> fiddler Options> HTTPS tab.

Select the checkbox. The following dialog box is displayed. Click "yes"

Click "yes" and set it.

Basic interface of Fiddler

Look at the basic interface of Fiddler

 

The Inspectors tab contains many messages for viewing request or response. The raw tab can view the complete message, and the headers tab can only view the header in the message. For example:

 

HTTP statistics view of Fiddler

By displaying all the HTTP traffic, Fiddler can easily show you which files have generated the page for your current request. By using the Statistics tab, you can select multiple sessions to collect statistics on the total information of these sessions, such as the number of requests and the number of transmitted bytes.

Select the first request and the last request to obtain the total time consumed by page loading. You can also specify the most time-consuming requests from the bar chart to optimize the access speed of the page.

Use of quickexec command line

In the lower left corner of Fiddler, a command line tool named quickexec allows you to directly enter commands.

Common Commands include:

Help opens the official usage page and lists all commands.

CLS clear screen (CTRL + X can also clear screen)

Select command for selecting sessions

?. PNG is used to select an image with a PNG suffix.

BPU interception request

 

Set a breakpoint modification request in Fiddler

[Tank] The most powerful function of Fiddler is to set a breakpoint. After a breakpoint is set, you can modify any information about httprequest, including host, Cookie, or data in the form. You can set breakpoints in either of the following ways:

First, open fiddler and click rules-> automatic breakpoint-> before requests (this method will interrupt all sessions)

How can we eliminate commands? Click rules-> automatic breakpoint-> disabled

Type 2: Enter the command BPU www.baidu.com in the command line (this method will only interrupt www.baidu.com)

How can we eliminate commands? Enter the command BPU in the command line.

 

Check an instance and simulate logon to the blog garden. on IE, open the logon page of the blog garden, enter the wrong username and password, use Fiddler to interrupt the session, and change it to the correct username and password. In this way, you can log on successfully.

1. Use IE to open the blog Park login interface http://passport.cnblogs.com/login.aspx
2. Open fiddler and enter BPU http://passport.cnblogs.com/login.aspx in the command line
3. Enter the wrong user name and password and click to log on.
4. fiddler can interrupt this session. Select the interrupted session, click webforms tab under inspectors to change the user name and password, and then click Run to completion, as shown in.
5. The result is a correct logon to the blog

 

 

Set a breakpoint to modify response in Fiddler

Of course, response can also be modified in Fiddler.

First, open fiddler and click rules-> automatic breakpoint-> after response (this method will interrupt all sessions)

How can we eliminate commands? Click rules-> automatic breakpoint-> disabled

Type 2: Enter the command bpafter www.baidu.com in the command line (this method will only interrupt www.baidu.com)

How can we eliminate commands? Enter the command bpafter in the command line,

The usage is similar to that in the previous section.

Create autoresponder rules in Fiddler

The autoresponder tab of Fiddler allows you to return files from the local machine without sending HTTP requests to the server.

View the example. 1. Open the homepage of the blog garden, save the logo image of the blog garden to your local device, and modify the image.

2. Open Fiddler to find the logo image session, http://static.cnblogs.com/images/logo_2012_lantern_festival.gif, drag this session under the autoresponer Tab

3. Select Enable Automatic reaponses and unmatched requests passthrough.

4. Under the rule editor below, select find a file... select the image saved locally. Finally, click Save to save.

5. Use the IE blog garden homepage again. You will see that the pictures on the homepage are local.

 



How to filter sessions in Fiddler

Every time you use Fiddler to open a website, you can see dozens of sessions in Fiddler. The best way is to filter out some sessions, such as the pictures. fiddler provides the filter function. In the Filters tab on the right, there are many options in it. After a little research, you will know how to use it.

 

Session comparison in Fiddler

Select two sessions, right-click Compare, and you can use windiff to compare the differences between the two sessions (of course you need to install windiff)

 

Encoding gadgets provided by fiddler

Click textwizard on the fiddler toolbar. This tool can be set to encode and decode string.

Query sessions in Fiddler

Press Ctrl + F to open the find sessions dialog box and enter the keyword to query the session you want. The queried session is displayed in yellow.

Saving sessions in Fiddler

Sometimes we need to save the session so that it can be sent to someone else or analyzed later. To save a session, follow these steps:

Select the session you want to save and click File> Save> selected sessions.

Script System of Fiddler

Fiddler's most complex is the script system's official help documentation: http://www.fiddler2.com/Fiddler/dev/ScriptSamples.asp

First install the syntaxview plug-in, inspectors tab-> Get syntaxview tab-> download and install syntaxview now...

 

After the installation is successful, the fiddler will have an additional fiddler script tab, as shown in figure

In this example, we can write scripts and check the instances to display red for all cnblogs sessions.

Place the script in the onbeforerequest (osession: Session) method and click "Save script"

     if (oSession.HostnameIs("www.cnblogs.com")) {
oSession["ui-color"] = "red";
}

In this way, all cnblogs sessions will be displayed in red.

 

How to Use fiddler when debugging a website in

We also need to use Fiddler to analyze HTTP when developing ASP. NET websites using Visual stuido. By default, Fiddler cannot sniff localhost websites. However, if you add a dot after localhost, the fiddler can sniff it.

For example, the original ASP. the net address is http: // localhost: 2391/default. aspx. After adding a vertex, it becomes http: // localhost.: 2391/default. aspx is enough.

 

The second method is to add 127.0.0.1 localsite to the hosts file.

How do you access http: // localsite: port number. In this way, the fiddler can also be intercepted.

 

Response is garbled

Sometimes we can see that the HTML in response is garbled because the HTML is compressed. We can decompress it in two ways.

1. Click "response is encoded any may need to be decoded before inspection. Click here to transform" above response raw"

2. Select "decode" in the toolbar ". This will automatically decompress the package.

From: http://www.cnblogs.com/TankXiao/archive/2012/02/06/2337728.html

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.