Customize Web Sessions List

To customize Fiddler's Web Sessions Listadd rules using FiddlerScript to the OnBeforeRequest function (except where noted). For example:

Display in the "Custom Column" the time of the original request

    oSession["ui-customcolumn"] += DateTime.Now.ToString("h:mm:ss.ffff ");

Show any Set-Cookie headers in Custom column in Session list. (in OnBeforeResponse)

    oSession["ui-customcolumn"] = oSession.oResponse["Set-Cookie"];

Mark any requests which send cookies in red, and show the value in the Custom column. Otherwise, mark request in green.

    if (oSession.oRequest.headers.Exists("Cookie")) { oSession["ui-color"]="red"; oSession["ui-customcolumn"] = oSession.oRequest["Cookie"]; } else oSession["ui-color"]="green";

Hide requests for .GIFs from the session list

    if (oSession.url.EndsWith(".gif")){ oSession["ui-hide"]="hiding image requests"; //String value not important }

Hide completed responses which returned images (in OnBeforeResponse)

    if (oSession.oResponse.headers.ExistsAndContains("Content-Type", "image/")) { oSession["ui-hide"] = "hiding images"; // String value not important }

Hide requests to domains except those I care about

    if (!oSession.HostnameIs("domainIcareabout.com")){ oSession["ui-hide"] = "hiding boring domains"; // String value not important }

Unhide any response which returned a 404 (in OnBeforeResponse)

    if (oSession.responseCode == 404){ oSession.oFlags.Remove("ui-hide"); }

Flag all pages in which the server sends a cookie (in OnBeforeResponse)

    if (oSession.oResponse.headers.Exists("Set-Cookie") || oSession.utilDecodeResponse(); oSession.utilFindInResponse("document.cookie", false)>-1 || oSession.utilFindInResponse('HTTP-EQUIV="Set-Cookie"', false)>-1){ oSession["ui-color"]="purple"; }

Show redirection target Location in Session List (In OnBeforeResponse)

    if ((oSession.responseCode > 299) && (oSession.responseCode < 308)){ oSession["ui-customcolumn"] = oSession.oResponse["Location"]; }

Add image size information in a column. (Global scope) Note: you must add System.drawing.dll inside Tools > Fiddler Options > Extensions > References.

    public static BindUIColumn("ImageSize", 60) function FillImageSizeColumn(oS: Session){ if ((oS.oResponse != null) && (oS.oResponse.headers != null)) { try{ if (!oS.oResponse.headers.ExistsAndContains("Content-Type", "image/")) return "NotAnImage"; var oMS: System.IO.MemoryStream = new System.IO.MemoryStream(oS.responseBodyBytes); var i:System.Drawing.Bitmap = new System.Drawing.Bitmap(oMS); return (i.Width + " x " + i.Height); } catch(e) { return "err"; } } return String.Empty; }

Search all text responses for a list of strings and flag sessions (in OnBeforeRequest)

    oSession.utilDecodeResponse(); // Create a array of strings we're looking for. var oFindStrings = new Array( "XMLHttp", "onreadystatechange", "readyState", "responseBody", "responseText", "responseXML", "statusText", "abort", "getAllResponseHeaders", "getResponseHeader", "setRequestHeader"); // For each target string, check the response to see if it's present. var iEach=0; oSession["ui-customcolumn"]=String.Empty; for (iEach; iEach<oFindStrings.length; iEach++){ if (oSession.utilFindInResponse(oFindStrings[iEach], false)>0) { oSession["ui-color"]="purple"; oSession["ui-customcolumn"] += oFindStrings[iEach]+"; "; } }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值