36
Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer [email protected] Note: Session includes demos and code samples. For optimal viewing, please sit near the front!

Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer [email protected] Note: Session includes demos and code samples

Embed Size (px)

Citation preview

Page 1: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

Advanced Web Debugging with Fiddler

Eric LawrenceProgram ManagerInternet [email protected]

Note: Session includes demos and code samples. For optimal viewing, please sit near the front!

Page 2: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

TRAFFIC CAPTUREGET /data HTTP/1.1

Page 3: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

Typical Architecture

Internet Explorer

WinINET

Office

CryptoAPI WinHTTP

Fiddler

Firefox

Upstream Proxy

example.com

Firewall

Page 4: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

Debug Across Devices

Fiddler InternetInternet

Page 5: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

FiddlerHook for Firefox

Page 6: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

TRAFFIC IMPORTFiddler, FiddlerCap, and IE9

Page 7: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

FiddlerCap

FiddlerCap is a lightweight capture tool

Page 8: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

IE9 Developer Tools

IE9’s Developer Tools include a “Network” tab

Page 9: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

TRAFFIC ANALYSISExamine Requests and Responses

Page 10: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

Filtering Traffic

•Ignore Images & CONNECTs•Application Type Filter•Process Filter•Using QuickExec•Using Find

Page 11: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

Output Options

• Copy sessions to the clipboard• Store as a plaintext file• Extract binary response bodies• Archive to a database• Export a Visual Studio .WebTest file• Write your own…• Fiddler’s native “Session Archive ZIP” (SAZ)

Format

Page 12: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

Traffic Comparison

Use WinDiff to compare HTTP requests and

responses.

Page 13: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

Traffic Comparison

“Viewer” mode allows examining multiple captures side-by-side.

fiddler.exe -viewer

Page 14: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

TRAFFIC MODIFICATIONRewriting HTTP(S) Traffic

Page 15: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

Automated Rewrites

•Simple Built-in Rules•The HOSTS extension

Page 16: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

Breakpoint Debugging

Use Fiddler inspectors to modify requests and

responses….

Page 17: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

Understanding Streaming

Timeline view of Buffering Mode

Timeline view of Streaming Mode

Page 18: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

Request Builder

Create hand-built HTTP requests, or modify and

reissue a request previously captured.

Page 19: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

Simple Filters

Flag, modify or remove headers from all requests and responses.

Page 20: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

AutoResponder

Replay previously captured or generated traffic.

Page 21: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

SCRIPTING AND EXTENSIBILITYPowering Up Fiddler

Page 22: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

Understanding Extensibility

Fiddler 2

Fiddler ScriptEngineFiddler ScriptEngine

Inspector2Inspector2

Inspector2Inspector2

IFiddlerExtension IFiddlerExtension

IFiddlerExtension IFiddlerExtension

Fiddler ProxyFiddler Proxy

Your FiddlerScriptYour FiddlerScript

Xceed*.dllXceed*.dll Makecert.exeMakecert.exe

Your

Aut

omati

onYo

ur A

utom

ation

Page 23: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

FIDDLERSCRIPTLightweight extensibility using JavaScript

Page 24: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

FiddlerScript

Page 25: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

FiddlerScript:Request Modification

static function OnBeforeRequest(oS: Session){

if (oS.uriContains(".aspx")) { oS["ui-color"] = "red";}

if (m_DisableCaching){ oS.oRequest.headers.Remove("If-None-Match"); oS.oRequest.headers.Remove("If-Modified-Since"); oS.oRequest["Pragma"] = "no-cache"; }}

Page 26: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

FiddlerScript:Response Modification

static function OnBeforeResponse(oS: Session) {

oS.utilDecodeResponse(); oS.utilPrependToResponseBody("Injected Content!");

}

Page 27: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

EXTENSIONSPowerful extensibility using any .NET Language

Page 28: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

neXpert

Page 29: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

Watcher

http://websecuritytool.codeplex.com/

Automated (passive) security analysis

Page 30: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

TEST INTEGRATIONIntegrating Fiddler into your tools

Page 31: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

ExecAction

The ExecAction.exe command line utility calls into the OnExecAction function in script and Fiddler extensions.

Page 32: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

FiddlerCore

Fiddler 2

Fiddler ScriptEngineFiddler ScriptEngine

Inspector2Inspector2

Inspector2Inspector2

IFiddlerExtension IFiddlerExtension

IFiddlerExtension IFiddlerExtension

FiddlerCoreFiddlerCore

YourApp.exeYourApp.exe

FiddlerCoreFiddlerCore

Fiddler application with extensions Your application hosting FiddlerCore

Your FiddlerScriptYour FiddlerScript

Xceed*.dllXceed*.dll Makecert.exeMakecert.exe Makecert.exeMakecert.exe

Page 33: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

Programming with FiddlerCore

// Call Startup to tell FiddlerCore to begin // listening on the specified port, register as // the system proxy and decrypt HTTPS traffic.Fiddler.FiddlerApplication.Startup(8877, true, true);

Fiddler.FiddlerApplication.BeforeResponse += delegate(Fiddler.Session oS) { Console.WriteLine("{0}:HTTP {1} for {2}", oS.id, oS.responseCode, oS.fullUrl); }; // Call Shutdown to tell FiddlerCore to stop// listening and unregister as the system proxyFiddler.FiddlerApplication.Shutdown();

Page 34: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

Call To Action

• Try the Watcher & neXpert extensions• Use FiddlerCap to collect traffic from the field• Check out import from the IE9 Developer Tools

Page 35: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

Questions and Resources

ResourcesoMeet the IE Team in the MIX “Commons”o http://www.fiddler2.com/mix/o [email protected]

Please fill out an evaluation form for this session (FT-50).

Thank you!

Page 36: Advanced Web Debugging with Fiddler Eric Lawrence Program Manager Internet Explorer ericlaw@microsoft.com Note: Session includes demos and code samples

© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Internet Explorer, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.

The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after

the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.