Fiddler小技巧之添加请求耗时Timetaken/qIP/请求方法Method列
用Fiddler抓包时如何快速找到自己想要的请求呢,可以通过请求类型(post/get)快速定位,以下方法是通过修改Fiddler的自定义代理规则,可以在会话栏添加请求耗时Timetaken/请求IP/请求方法Method等列:
请求耗时:
直接加在Handlers{ 后面
1 public static BindUIColumn("Time Taken") 2 function CalcTimingCol(oS: Session){ 3 var sResult = String.Empty; 4 if ((oS.Timers.ServerDoneResponse > oS.Timers.ClientDoneRequest)) 5 { 6 sResult = (oS.Timers.ServerDoneResponse - oS.Timers.ClientDoneRequest).ToString(); 7 } 8 return sResult; 9 #可以直接找到对应的列,替换全部
请求IP:
加在main函数后面
1 static function Main() { 2 var today: Date = new Date(); 3 FiddlerObject.StatusText = " CustomRules.js was loaded at: " + today; 4 // Uncomment to add a "Server" column containing the response "Server" header, if present 5 //请求IP 6 FiddlerObject.UI.lvSessions.AddBoundColumn("Server IP", 120, "X-HostIP");
请求方法:
办法一:
最终效果如图:
打开Rules中的Customize Rules如图:
在CustomRules.js里找到.static function Main() 添加如下一段脚本
1 static function Main() { 2 var today: Date = new Date(); 3 FiddlerObject.StatusText = " CustomRules.js was loaded at: " + today; 4 //请求类型 5 FiddlerObject.UI.lvSessions.AddBoundColumn("HTTPMethod",60,getHTTPMethod ); 6 } 7 static function getHTTPMethod(oS: Session){ 8 if (null != oS.oRequest) return oS.oRequest.headers.HTTPMethod; else return String.Empty;
参考网站:
http://docs.telerik.com/fiddler/knowledgebase/fiddlerscript/addcolumns
办法二(不需要去改规则代码,推荐!):
可以看到列了:)
实际效果(其实请求耗时Timetaken/请求IP用处不大,主要是请求方法Method,所以最后还是去掉了请求耗时和IP):
参考博客:
Fiddler小技巧之添加请求耗时/IP/Method列 - CSDN博客
自定义规则Fiddler-CustomRules.js脚本原代码:
1 import System; 2 import System.Windows.Forms; 3 import Fiddler; 4 5 // INTRODUCTION 6 // 7 // Well, hello there! 8 // 9 // Don't be scared! :-) 10 // 11 // This is the FiddlerScript Rules file, which creates some of the menu commands and 12 // other features of Fiddler. You can edit this file to modify or add new commands. 13 // 14 // The original version of this file is named SampleRules.js and it is in the 15 // \Program Files\Fiddler\ folder. When Fiddler first runs, it creates a copy named 16 // CustomRules.js inside your \Documents\Fiddler2\Scripts folder. If you make a 17 // mistake in editing this file, simply delete the CustomRules.js file and restart 18 // Fiddler. A fresh copy of the default rules will be created from the original 19 // sample rules file. 20 21 // The best way to edit this file is to install the FiddlerScript Editor, part of 22 // the free SyntaxEditing addons. Get it here: http://fiddler2.com/r/?SYNTAXVIEWINSTALL 23 24 // GLOBALIZATION NOTE: Save this file using UTF-8 Encoding. 25 26 // JScript.NET Reference 27 // http://fiddler2.com/r/?msdnjsnet 28 // 29 // FiddlerScript Reference 30 // http://fiddler2.com/r/?fiddlerscriptcookbook 31 32 class Handlers 33 { 34 // ***************** 35 // 36 // This is the Handlers class. Pretty much everything you ever add to FiddlerScript 37 // belongs right inside here, or inside one of the already-existing functions below. 38 // 39 // ***************** 40 41 // The following snippet demonstrates a custom-bound column for the Web Sessions list. 42 // See http://fiddler2.com/r/?fiddlercolumns for more info 43 /* 44 public static BindUIColumn("Method", 60) 45 function FillMethodColumn(oS: Session): String { 46 return oS.RequestMethod; 47 } 48 */ 49 50 // The following snippet demonstrates how to create a custom tab that shows simple text 51 /* 52 public BindUITab("Flags") 53 static function FlagsReport(arrSess: Session[]):String { 54 var oSB: System.Text.StringBuilder = new System.Text.StringBuilder(); 55 for (var i:int = 0; i<arrSess.Length; i++) 56 { 57 oSB.AppendLine("SESSION FLAGS"); 58 oSB.AppendFormat("{0}: {1}\n", arrSess[i].id, arrSess[i].fullUrl); 59 for(var sFlag in arrSess[i].oFlags) 60 { 61 oSB.AppendFormat("\t{0}:\t\t{1}\n", sFlag.Key, sFlag.Value); 62 } 63 } 64 return oSB.ToString(); 65 } 66 */ 67 68 // You can create a custom menu like so: 69 /* 70 QuickLinkMenu("&Links") 71 QuickLinkItem("IE GeoLoc TestDrive", "http://ie.microsoft.com/testdrive/HTML5/Geolocation/Default.html") 72 QuickLinkItem("FiddlerCore", "http://fiddler2.com/fiddlercore") 73 public static function DoLinksMenu(sText: String, sAction: String) 74 { 75 Utilities.LaunchHyperlink(sAction); 76 } 77 */ 78 79 public static RulesOption("Hide 304s") 80 BindPref("fiddlerscript.rules.Hide304s") 81 var m_Hide304s: boolean = false; 82 83 // Cause Fiddler to override the Accept-Language header with one of the defined values 84 public static RulesOption("Request &Japanese Content") 85 var m_Japanese: boolean = false; 86 87 // Automatic Authentication 88 public static RulesOption("&Automatically Authenticate") 89 BindPref("fiddlerscript.rules.AutoAuth") 90 var m_AutoAuth: boolean = false; 91 92 // Cause Fiddler to override the User-Agent header with one of the defined values 93 // The page http://browserscope2.org/browse?category=selectors&ua=Mobile%20Safari is a good place to find updated versions of these 94 RulesString("&User-Agents", true) 95 BindPref("fiddlerscript.ephemeral.UserAgentString") 96 RulesStringValue(0,"Netscape &3", "Mozilla/3.0 (Win95; I)") 97 RulesStringValue(1,"WinPhone8.1", "Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 520) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537") 98 RulesStringValue(2,"&Safari5 (Win7)", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1") 99 RulesStringValue(3,"Safari9 (Mac)", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11) AppleWebKit/601.1.56 (KHTML, like Gecko) Version/9.0 Safari/601.1.56") 100 RulesStringValue(4,"iPad", "Mozilla/5.0 (iPad; CPU OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12F5027d Safari/600.1.4") 101 RulesStringValue(5,"iPhone6", "Mozilla/5.0 (iPhone; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12F70 Safari/600.1.4") 102 RulesStringValue(6,"IE &6 (XPSP2)", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)") 103 RulesStringValue(7,"IE &7 (Vista)", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1)") 104 RulesStringValue(8,"IE 8 (Win2k3 x64)", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; WOW64; Trident/4.0)") 105 RulesStringValue(9,"IE &8 (Win7)", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)") 106 RulesStringValue(10,"IE 9 (Win7)", "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)") 107 RulesStringValue(11,"IE 10 (Win8)", "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)") 108 RulesStringValue(12,"IE 11 (Surface2)", "Mozilla/5.0 (Windows NT 6.3; ARM; Trident/7.0; Touch; rv:11.0) like Gecko") 109 RulesStringValue(13,"IE 11 (Win8.1)", "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko") 110 RulesStringValue(14,"Edge (Win10)", "Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.11082") 111 RulesStringValue(15,"&Opera", "Opera/9.80 (Windows NT 6.2; WOW64) Presto/2.12.388 Version/12.17") 112 RulesStringValue(16,"&Firefox 3.6", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.7) Gecko/20100625 Firefox/3.6.7") 113 RulesStringValue(17,"&Firefox 43", "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0") 114 RulesStringValue(18,"&Firefox Phone", "Mozilla/5.0 (Mobile; rv:18.0) Gecko/18.0 Firefox/18.0") 115 RulesStringValue(19,"&Firefox (Mac)", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0") 116 RulesStringValue(20,"Chrome (Win)", "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.48 Safari/537.36") 117 RulesStringValue(21,"Chrome (Android)", "Mozilla/5.0 (Linux; Android 5.1.1; Nexus 5 Build/LMY48B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.78 Mobile Safari/537.36") 118 RulesStringValue(22,"ChromeBook", "Mozilla/5.0 (X11; CrOS x86_64 6680.52.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.74 Safari/537.36") 119 RulesStringValue(23,"GoogleBot Crawler", "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)") 120 RulesStringValue(24,"Kindle Fire (Silk)", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.0.22.79_10013310) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true") 121 RulesStringValue(25,"&Custom...", "%CUSTOM%") 122 public static var sUA: String = null; 123 124 // Cause Fiddler to delay HTTP traffic to simulate typical 56k modem conditions 125 public static RulesOption("Simulate &Modem Speeds", "Per&formance") 126 var m_SimulateModem: boolean = false; 127 128 // Removes HTTP-caching related headers and specifies "no-cache" on requests and responses 129 public static RulesOption("&Disable Caching", "Per&formance") 130 var m_DisableCaching: boolean = false; 131 132 public static RulesOption("Cache Always &Fresh", "Per&formance") 133 var m_AlwaysFresh: boolean = false; 134 135 // Force a manual reload of the script file. Resets all 136 // RulesOption variables to their defaults. 137 public static ToolsAction("Reset Script") 138 function DoManualReload() { 139 FiddlerObject.ReloadScript(); 140 } 141 142 public static ContextAction("Decode Selected Sessions") 143 function DoRemoveEncoding(oSessions: Session[]) { 144 for (var x:int = 0; x < oSessions.Length; x++){ 145 oSessions[x].utilDecodeRequest(); 146 oSessions[x].utilDecodeResponse(); 147 } 148 UI.actUpdateInspector(true,true); 149 } 150 151 static function OnBeforeRequest(oSession: Session) { 152 // Sample Rule: Color ASPX requests in RED 153 // if (oSession.uriContains(".aspx")) { oSession["ui-color"] = "red"; } 154 155 // Sample Rule: Flag POSTs to fiddler2.com in italics 156 // if (oSession.HostnameIs("www.fiddler2.com") && oSession.HTTPMethodIs("POST")) { oSession["ui-italic"] = "yup"; } 157 158 // Sample Rule: Break requests for URLs containing "/sandbox/" 159 // if (oSession.uriContains("/sandbox/")) { 160 // oSession.oFlags["x-breakrequest"] = "yup"; // Existence of the x-breakrequest flag creates a breakpoint; the "yup" value is unimportant. 161 // } 162 163 if ((null != gs_ReplaceToken) && (oSession.url.indexOf(gs_ReplaceToken)>-1)) { // Case sensitive 164 oSession.url = oSession.url.Replace(gs_ReplaceToken, gs_ReplaceTokenWith); 165 } 166 if ((null != gs_OverridenHost) && (oSession.host.toLowerCase() == gs_OverridenHost)) { 167 oSession["x-overridehost"] = gs_OverrideHostWith; 168 } 169 170 if ((null!=bpRequestURI) && oSession.uriContains(bpRequestURI)) { 171 oSession["x-breakrequest"]="uri"; 172 } 173 174 if ((null!=bpMethod) && (oSession.HTTPMethodIs(bpMethod))) { 175 oSession["x-breakrequest"]="method"; 176 } 177 178 if ((null!=uiBoldURI) && oSession.uriContains(uiBoldURI)) { 179 oSession["ui-bold"]="QuickExec"; 180 } 181 182 if (m_SimulateModem) { 183 // Delay sends by 300ms per KB uploaded. 184 oSession["request-trickle-delay"] = "300"; 185 // Delay receives by 150ms per KB downloaded. 186 oSession["response-trickle-delay"] = "150"; 187 } 188 189 if (m_DisableCaching) { 190 oSession.oRequest.headers.Remove("If-None-Match"); 191 oSession.oRequest.headers.Remove("If-Modified-Since"); 192 oSession.oRequest["Pragma"] = "no-cache"; 193 } 194 195 // User-Agent Overrides 196 if (null != sUA) { 197 oSession.oRequest["User-Agent"] = sUA; 198 } 199 200 if (m_Japanese) { 201 oSession.oRequest["Accept-Language"] = "ja"; 202 } 203 204 if (m_AutoAuth) { 205 // Automatically respond to any authentication challenges using the 206 // current Fiddler user's credentials. You can change (default) 207 // to a domain\\username:password string if preferred. 208 // 209 // WARNING: This setting poses a security risk if remote 210 // connections are permitted! 211 oSession["X-AutoAuth"] = "(default)"; 212 } 213 214 if (m_AlwaysFresh && (oSession.oRequest.headers.Exists("If-Modified-Since") || oSession.oRequest.headers.Exists("If-None-Match"))) 215 { 216 oSession.utilCreateResponseAndBypassServer(); 217 oSession.responseCode = 304; 218 oSession["ui-backcolor"] = "Lavender"; 219 } 220 } 221 222 // This function is called immediately after a set of request headers has 223 // been read from the client. This is typically too early to do much useful 224 // work, since the body hasn't yet been read, but sometimes it may be useful. 225 // 226 // For instance, see 227 // http://blogs.msdn.com/b/fiddler/archive/2011/11/05/http-expect-continue-delays-transmitting-post-bodies-by-up-to-350-milliseconds.aspx 228 // for one useful thing you can do with this handler. 229 // 230 // Note: oSession.requestBodyBytes is not available within this function! 231 /* 232 static function OnPeekAtRequestHeaders(oSession: Session) { 233 var sProc = ("" + oSession["x-ProcessInfo"]).ToLower(); 234 if (!sProc.StartsWith("mylowercaseappname")) oSession["ui-hide"] = "NotMyApp"; 235 } 236 */ 237 238 // 239 // If a given session has response streaming enabled, then the OnBeforeResponse function 240 // is actually called AFTER the response was returned to the client. 241 // 242 // In contrast, this OnPeekAtResponseHeaders function is called before the response headers are 243 // sent to the client (and before the body is read from the server). Hence this is an opportune time 244 // to disable streaming (oSession.bBufferResponse = true) if there is something in the response headers 245 // which suggests that tampering with the response body is necessary. 246 // 247 // Note: oSession.responseBodyBytes is not available within this function! 248 // 249 static function OnPeekAtResponseHeaders(oSession: Session) { 250 //FiddlerApplication.Log.LogFormat("Session {0}: Response header peek shows status is {1}", oSession.id, oSession.responseCode); 251 if (m_DisableCaching) { 252 oSession.oResponse.headers.Remove("Expires"); 253 oSession.oResponse["Cache-Control"] = "no-cache"; 254 } 255 256 if ((bpStatus>0) && (oSession.responseCode == bpStatus)) { 257 oSession["x-breakresponse"]="status"; 258 oSession.bBufferResponse = true; 259 } 260 261 if ((null!=bpResponseURI) && oSession.uriContains(bpResponseURI)) { 262 oSession["x-breakresponse"]="uri"; 263 oSession.bBufferResponse = true; 264 } 265 266 } 267 268 static function OnBeforeResponse(oSession: Session) { 269 if (m_Hide304s && oSession.responseCode == 304) { 270 oSession["ui-hide"] = "true"; 271 } 272 } 273 274 /* 275 // This function executes just before Fiddler returns an error that it has 276 // itself generated (e.g. "DNS Lookup failure") to the client application. 277 // These responses will not run through the OnBeforeResponse function above. 278 static function OnReturningError(oSession: Session) { 279 } 280 */ 281 /* 282 // This function executes after Fiddler finishes processing a Session, regardless 283 // of whether it succeeded or failed. Note that this typically runs AFTER the last 284 // update of the Web Sessions UI listitem, so you must manually refresh the Session's 285 // UI if you intend to change it. 286 static function OnDone(oSession: Session) { 287 } 288 */ 289 290 /* 291 static function OnBoot() { 292 MessageBox.Show("Fiddler has finished booting"); 293 System.Diagnostics.Process.Start("iexplore.exe"); 294 295 UI.ActivateRequestInspector("HEADERS"); 296 UI.ActivateResponseInspector("HEADERS"); 297 } 298 */ 299 300 /* 301 static function OnBeforeShutdown(): Boolean { 302 // Return false to cancel shutdown. 303 return ((0 == FiddlerApplication.UI.lvSessions.TotalItemCount()) || 304 (DialogResult.Yes == MessageBox.Show("Allow Fiddler to exit?", "Go Bye-bye?", 305 MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2))); 306 } 307 */ 308 309 /* 310 static function OnShutdown() { 311 MessageBox.Show("Fiddler has shutdown"); 312 } 313 */ 314 315 /* 316 static function OnAttach() { 317 MessageBox.Show("Fiddler is now the system proxy"); 318 } 319 */ 320 321 /* 322 static function OnDetach() { 323 MessageBox.Show("Fiddler is no longer the system proxy"); 324 } 325 */ 326 327 // The Main() function runs everytime your FiddlerScript compiles 328 static function Main() { 329 var today: Date = new Date(); 330 FiddlerObject.StatusText = " CustomRules.js was loaded at: " + today; 331 332 // Uncomment to add a "Server" column containing the response "Server" header, if present 333 // UI.lvSessions.AddBoundColumn("Server", 50, "@response.server"); 334 335 // Uncomment to add a global hotkey (Win+G) that invokes the ExecAction method below... 336 // UI.RegisterCustomHotkey(HotkeyModifiers.Windows, Keys.G, "screenshot"); 337 } 338 339 // These static variables are used for simple breakpointing & other QuickExec rules 340 BindPref("fiddlerscript.ephemeral.bpRequestURI") 341 public static var bpRequestURI:String = null; 342 343 BindPref("fiddlerscript.ephemeral.bpResponseURI") 344 public static var bpResponseURI:String = null; 345 346 BindPref("fiddlerscript.ephemeral.bpMethod") 347 public static var bpMethod: String = null; 348 349 static var bpStatus:int = -1; 350 static var uiBoldURI: String = null; 351 static var gs_ReplaceToken: String = null; 352 static var gs_ReplaceTokenWith: String = null; 353 static var gs_OverridenHost: String = null; 354 static var gs_OverrideHostWith: String = null; 355 356 // The OnExecAction function is called by either the QuickExec box in the Fiddler window, 357 // or by the ExecAction.exe command line utility. 358 static function OnExecAction(sParams: String[]): Boolean { 359 360 FiddlerObject.StatusText = "ExecAction: " + sParams[0]; 361 362 var sAction = sParams[0].toLowerCase(); 363 switch (sAction) { 364 case "bold": 365 if (sParams.Length<2) {uiBoldURI=null; FiddlerObject.StatusText="Bolding cleared"; return false;} 366 uiBoldURI = sParams[1]; FiddlerObject.StatusText="Bolding requests for " + uiBoldURI; 367 return true; 368 case "bp": 369 FiddlerObject.alert("bpu = breakpoint request for uri\nbpm = breakpoint request method\nbps=breakpoint response status\nbpafter = breakpoint response for URI"); 370 return true; 371 case "bps": 372 if (sParams.Length<2) {bpStatus=-1; FiddlerObject.StatusText="Response Status breakpoint cleared"; return false;} 373 bpStatus = parseInt(sParams[1]); FiddlerObject.StatusText="Response status breakpoint for " + sParams[1]; 374 return true; 375 case "bpv": 376 case "bpm": 377 if (sParams.Length<2) {bpMethod=null; FiddlerObject.StatusText="Request Method breakpoint cleared"; return false;} 378 bpMethod = sParams[1].toUpperCase(); FiddlerObject.StatusText="Request Method breakpoint for " + bpMethod; 379 return true; 380 case "bpu": 381 if (sParams.Length<2) {bpRequestURI=null; FiddlerObject.StatusText="RequestURI breakpoint cleared"; return false;} 382 bpRequestURI = sParams[1]; 383 FiddlerObject.StatusText="RequestURI breakpoint for "+sParams[1]; 384 return true; 385 case "bpa": 386 case "bpafter": 387 if (sParams.Length<2) {bpResponseURI=null; FiddlerObject.StatusText="ResponseURI breakpoint cleared"; return false;} 388 bpResponseURI = sParams[1]; 389 FiddlerObject.StatusText="ResponseURI breakpoint for "+sParams[1]; 390 return true; 391 case "overridehost": 392 if (sParams.Length<3) {gs_OverridenHost=null; FiddlerObject.StatusText="Host Override cleared"; return false;} 393 gs_OverridenHost = sParams[1].toLowerCase(); 394 gs_OverrideHostWith = sParams[2]; 395 FiddlerObject.StatusText="Connecting to [" + gs_OverrideHostWith + "] for requests to [" + gs_OverridenHost + "]"; 396 return true; 397 case "urlreplace": 398 if (sParams.Length<3) {gs_ReplaceToken=null; FiddlerObject.StatusText="URL Replacement cleared"; return false;} 399 gs_ReplaceToken = sParams[1]; 400 gs_ReplaceTokenWith = sParams[2].Replace(" ", "%20"); // Simple helper 401 FiddlerObject.StatusText="Replacing [" + gs_ReplaceToken + "] in URIs with [" + gs_ReplaceTokenWith + "]"; 402 return true; 403 case "allbut": 404 case "keeponly": 405 if (sParams.Length<2) { FiddlerObject.StatusText="Please specify Content-Type to retain during wipe."; return false;} 406 UI.actSelectSessionsWithResponseHeaderValue("Content-Type", sParams[1]); 407 UI.actRemoveUnselectedSessions(); 408 UI.lvSessions.SelectedItems.Clear(); 409 FiddlerObject.StatusText="Removed all but Content-Type: " + sParams[1]; 410 return true; 411 case "stop": 412 UI.actDetachProxy(); 413 return true; 414 case "start": 415 UI.actAttachProxy(); 416 return true; 417 case "cls": 418 case "clear": 419 UI.actRemoveAllSessions(); 420 return true; 421 case "g": 422 case "go": 423 UI.actResumeAllSessions(); 424 return true; 425 case "goto": 426 if (sParams.Length != 2) return false; 427 Utilities.LaunchHyperlink("http://www.google.com/search?hl=en&btnI=I%27m+Feeling+Lucky&q=" + Utilities.UrlEncode(sParams[1])); 428 return true; 429 case "help": 430 Utilities.LaunchHyperlink("http://fiddler2.com/r/?quickexec"); 431 return true; 432 case "hide": 433 UI.actMinimizeToTray(); 434 return true; 435 case "log": 436 FiddlerApplication.Log.LogString((sParams.Length<2) ? "User couldn't think of anything to say..." : sParams[1]); 437 return true; 438 case "nuke": 439 UI.actClearWinINETCache(); 440 UI.actClearWinINETCookies(); 441 return true; 442 case "screenshot": 443 UI.actCaptureScreenshot(false); 444 return true; 445 case "show": 446 UI.actRestoreWindow(); 447 return true; 448 case "tail": 449 if (sParams.Length<2) { FiddlerObject.StatusText="Please specify # of sessions to trim the session list to."; return false;} 450 UI.TrimSessionList(int.Parse(sParams[1])); 451 return true; 452 case "quit": 453 UI.actExit(); 454 return true; 455 case "dump": 456 UI.actSelectAll(); 457 UI.actSaveSessionsToZip(CONFIG.GetPath("Captures") + "dump.saz"); 458 UI.actRemoveAllSessions(); 459 FiddlerObject.StatusText = "Dumped all sessions to " + CONFIG.GetPath("Captures") + "dump.saz"; 460 return true; 461 462 default: 463 if (sAction.StartsWith("http") || sAction.StartsWith("www.")) { 464 System.Diagnostics.Process.Start(sParams[0]); 465 return true; 466 } 467 else 468 { 469 FiddlerObject.StatusText = "Requested ExecAction: '" + sAction + "' not found. Type HELP to learn more."; 470 return false; 471 } 472 } 473 } 474 }
添加列之后的代码(代码中注释/*david 2018.6.27 add:*/处为新增的代码块):
1 import System; 2 import System.Windows.Forms; 3 import Fiddler; 4 5 // INTRODUCTION 6 // 7 // Well, hello there! 8 // 9 // Don't be scared! :-) 10 // 11 // This is the FiddlerScript Rules file, which creates some of the menu commands and 12 // other features of Fiddler. You can edit this file to modify or add new commands. 13 // 14 // The original version of this file is named SampleRules.js and it is in the 15 // \Program Files\Fiddler\ folder. When Fiddler first runs, it creates a copy named 16 // CustomRules.js inside your \Documents\Fiddler2\Scripts folder. If you make a 17 // mistake in editing this file, simply delete the CustomRules.js file and restart 18 // Fiddler. A fresh copy of the default rules will be created from the original 19 // sample rules file. 20 21 // The best way to edit this file is to install the FiddlerScript Editor, part of 22 // the free SyntaxEditing addons. Get it here: http://fiddler2.com/r/?SYNTAXVIEWINSTALL 23 24 // GLOBALIZATION NOTE: Save this file using UTF-8 Encoding. 25 26 // JScript.NET Reference 27 // http://fiddler2.com/r/?msdnjsnet 28 // 29 // FiddlerScript Reference 30 // http://fiddler2.com/r/?fiddlerscriptcookbook 31 32 class Handlers 33 { 34 // ***************** 35 // 36 // This is the Handlers class. Pretty much everything you ever add to FiddlerScript 37 // belongs right inside here, or inside one of the already-existing functions below. 38 // 39 // ***************** 40 41 // The following snippet demonstrates a custom-bound column for the Web Sessions list. 42 // See http://fiddler2.com/r/?fiddlercolumns for more info 43 /*david 2018.6.27 add: 44 public static BindUIColumn("Time Taken") 45 function CalcTimingCol(oS: Session){ 46 var sResult = String.Empty; 47 if ((oS.Timers.ServerDoneResponse > oS.Timers.ClientDoneRequest)) 48 { 49 sResult = (oS.Timers.ServerDoneResponse - oS.Timers.ClientDoneRequest).ToString(); 50 } 51 return sResult; 52 } 53 */ 54 /* 55 public static BindUIColumn("Method", 60) 56 function FillMethodColumn(oS: Session): String { 57 return oS.RequestMethod; 58 } 59 */ 60 61 62 // The following snippet demonstrates how to create a custom tab that shows simple text 63 /* 64 public BindUITab("Flags") 65 static function FlagsReport(arrSess: Session[]):String { 66 var oSB: System.Text.StringBuilder = new System.Text.StringBuilder(); 67 for (var i:int = 0; i<arrSess.Length; i++) 68 { 69 oSB.AppendLine("SESSION FLAGS"); 70 oSB.AppendFormat("{0}: {1}\n", arrSess[i].id, arrSess[i].fullUrl); 71 for(var sFlag in arrSess[i].oFlags) 72 { 73 oSB.AppendFormat("\t{0}:\t\t{1}\n", sFlag.Key, sFlag.Value); 74 } 75 } 76 return oSB.ToString(); 77 } 78 */ 79 80 // You can create a custom menu like so: 81 /* 82 QuickLinkMenu("&Links") 83 QuickLinkItem("IE GeoLoc TestDrive", "http://ie.microsoft.com/testdrive/HTML5/Geolocation/Default.html") 84 QuickLinkItem("FiddlerCore", "http://fiddler2.com/fiddlercore") 85 public static function DoLinksMenu(sText: String, sAction: String) 86 { 87 Utilities.LaunchHyperlink(sAction); 88 } 89 */ 90 91 public static RulesOption("Hide 304s") 92 BindPref("fiddlerscript.rules.Hide304s") 93 var m_Hide304s: boolean = false; 94 95 // Cause Fiddler to override the Accept-Language header with one of the defined values 96 public static RulesOption("Request &Japanese Content") 97 var m_Japanese: boolean = false; 98 99 // Automatic Authentication 100 public static RulesOption("&Automatically Authenticate") 101 BindPref("fiddlerscript.rules.AutoAuth") 102 var m_AutoAuth: boolean = false; 103 104 // Cause Fiddler to override the User-Agent header with one of the defined values 105 // The page http://browserscope2.org/browse?category=selectors&ua=Mobile%20Safari is a good place to find updated versions of these 106 RulesString("&User-Agents", true) 107 BindPref("fiddlerscript.ephemeral.UserAgentString") 108 RulesStringValue(0,"Netscape &3", "Mozilla/3.0 (Win95; I)") 109 RulesStringValue(1,"WinPhone8.1", "Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 520) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537") 110 RulesStringValue(2,"&Safari5 (Win7)", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1") 111 RulesStringValue(3,"Safari9 (Mac)", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11) AppleWebKit/601.1.56 (KHTML, like Gecko) Version/9.0 Safari/601.1.56") 112 RulesStringValue(4,"iPad", "Mozilla/5.0 (iPad; CPU OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12F5027d Safari/600.1.4") 113 RulesStringValue(5,"iPhone6", "Mozilla/5.0 (iPhone; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12F70 Safari/600.1.4") 114 RulesStringValue(6,"IE &6 (XPSP2)", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)") 115 RulesStringValue(7,"IE &7 (Vista)", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1)") 116 RulesStringValue(8,"IE 8 (Win2k3 x64)", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; WOW64; Trident/4.0)") 117 RulesStringValue(9,"IE &8 (Win7)", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)") 118 RulesStringValue(10,"IE 9 (Win7)", "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)") 119 RulesStringValue(11,"IE 10 (Win8)", "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)") 120 RulesStringValue(12,"IE 11 (Surface2)", "Mozilla/5.0 (Windows NT 6.3; ARM; Trident/7.0; Touch; rv:11.0) like Gecko") 121 RulesStringValue(13,"IE 11 (Win8.1)", "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko") 122 RulesStringValue(14,"Edge (Win10)", "Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.11082") 123 RulesStringValue(15,"&Opera", "Opera/9.80 (Windows NT 6.2; WOW64) Presto/2.12.388 Version/12.17") 124 RulesStringValue(16,"&Firefox 3.6", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.7) Gecko/20100625 Firefox/3.6.7") 125 RulesStringValue(17,"&Firefox 43", "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0") 126 RulesStringValue(18,"&Firefox Phone", "Mozilla/5.0 (Mobile; rv:18.0) Gecko/18.0 Firefox/18.0") 127 RulesStringValue(19,"&Firefox (Mac)", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0") 128 RulesStringValue(20,"Chrome (Win)", "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.48 Safari/537.36") 129 RulesStringValue(21,"Chrome (Android)", "Mozilla/5.0 (Linux; Android 5.1.1; Nexus 5 Build/LMY48B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.78 Mobile Safari/537.36") 130 RulesStringValue(22,"ChromeBook", "Mozilla/5.0 (X11; CrOS x86_64 6680.52.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.74 Safari/537.36") 131 RulesStringValue(23,"GoogleBot Crawler", "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)") 132 RulesStringValue(24,"Kindle Fire (Silk)", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.0.22.79_10013310) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true") 133 RulesStringValue(25,"&Custom...", "%CUSTOM%") 134 public static var sUA: String = null; 135 136 // Cause Fiddler to delay HTTP traffic to simulate typical 56k modem conditions 137 public static RulesOption("Simulate &Modem Speeds", "Per&formance") 138 var m_SimulateModem: boolean = false; 139 140 // Removes HTTP-caching related headers and specifies "no-cache" on requests and responses 141 public static RulesOption("&Disable Caching", "Per&formance") 142 var m_DisableCaching: boolean = false; 143 144 public static RulesOption("Cache Always &Fresh", "Per&formance") 145 var m_AlwaysFresh: boolean = false; 146 147 // Force a manual reload of the script file. Resets all 148 // RulesOption variables to their defaults. 149 public static ToolsAction("Reset Script") 150 function DoManualReload() { 151 FiddlerObject.ReloadScript(); 152 } 153 154 public static ContextAction("Decode Selected Sessions") 155 function DoRemoveEncoding(oSessions: Session[]) { 156 for (var x:int = 0; x < oSessions.Length; x++){ 157 oSessions[x].utilDecodeRequest(); 158 oSessions[x].utilDecodeResponse(); 159 } 160 UI.actUpdateInspector(true,true); 161 } 162 163 static function OnBeforeRequest(oSession: Session) { 164 // Sample Rule: Color ASPX requests in RED 165 // if (oSession.uriContains(".aspx")) { oSession["ui-color"] = "red"; } 166 167 // Sample Rule: Flag POSTs to fiddler2.com in italics 168 // if (oSession.HostnameIs("www.fiddler2.com") && oSession.HTTPMethodIs("POST")) { oSession["ui-italic"] = "yup"; } 169 170 // Sample Rule: Break requests for URLs containing "/sandbox/" 171 // if (oSession.uriContains("/sandbox/")) { 172 // oSession.oFlags["x-breakrequest"] = "yup"; // Existence of the x-breakrequest flag creates a breakpoint; the "yup" value is unimportant. 173 // } 174 175 if ((null != gs_ReplaceToken) && (oSession.url.indexOf(gs_ReplaceToken)>-1)) { // Case sensitive 176 oSession.url = oSession.url.Replace(gs_ReplaceToken, gs_ReplaceTokenWith); 177 } 178 if ((null != gs_OverridenHost) && (oSession.host.toLowerCase() == gs_OverridenHost)) { 179 oSession["x-overridehost"] = gs_OverrideHostWith; 180 } 181 182 if ((null!=bpRequestURI) && oSession.uriContains(bpRequestURI)) { 183 oSession["x-breakrequest"]="uri"; 184 } 185 186 if ((null!=bpMethod) && (oSession.HTTPMethodIs(bpMethod))) { 187 oSession["x-breakrequest"]="method"; 188 } 189 190 if ((null!=uiBoldURI) && oSession.uriContains(uiBoldURI)) { 191 oSession["ui-bold"]="QuickExec"; 192 } 193 194 if (m_SimulateModem) { 195 // Delay sends by 300ms per KB uploaded. 196 oSession["request-trickle-delay"] = "300"; 197 // Delay receives by 150ms per KB downloaded. 198 oSession["response-trickle-delay"] = "150"; 199 } 200 201 if (m_DisableCaching) { 202 oSession.oRequest.headers.Remove("If-None-Match"); 203 oSession.oRequest.headers.Remove("If-Modified-Since"); 204 oSession.oRequest["Pragma"] = "no-cache"; 205 } 206 207 // User-Agent Overrides 208 if (null != sUA) { 209 oSession.oRequest["User-Agent"] = sUA; 210 } 211 212 if (m_Japanese) { 213 oSession.oRequest["Accept-Language"] = "ja"; 214 } 215 216 if (m_AutoAuth) { 217 // Automatically respond to any authentication challenges using the 218 // current Fiddler user's credentials. You can change (default) 219 // to a domain\\username:password string if preferred. 220 // 221 // WARNING: This setting poses a security risk if remote 222 // connections are permitted! 223 oSession["X-AutoAuth"] = "(default)"; 224 } 225 226 if (m_AlwaysFresh && (oSession.oRequest.headers.Exists("If-Modified-Since") || oSession.oRequest.headers.Exists("If-None-Match"))) 227 { 228 oSession.utilCreateResponseAndBypassServer(); 229 oSession.responseCode = 304; 230 oSession["ui-backcolor"] = "Lavender"; 231 } 232 } 233 234 // This function is called immediately after a set of request headers has 235 // been read from the client. This is typically too early to do much useful 236 // work, since the body hasn't yet been read, but sometimes it may be useful. 237 // 238 // For instance, see 239 // http://blogs.msdn.com/b/fiddler/archive/2011/11/05/http-expect-continue-delays-transmitting-post-bodies-by-up-to-350-milliseconds.aspx 240 // for one useful thing you can do with this handler. 241 // 242 // Note: oSession.requestBodyBytes is not available within this function! 243 /* 244 static function OnPeekAtRequestHeaders(oSession: Session) { 245 var sProc = ("" + oSession["x-ProcessInfo"]).ToLower(); 246 if (!sProc.StartsWith("mylowercaseappname")) oSession["ui-hide"] = "NotMyApp"; 247 } 248 */ 249 250 // 251 // If a given session has response streaming enabled, then the OnBeforeResponse function 252 // is actually called AFTER the response was returned to the client. 253 // 254 // In contrast, this OnPeekAtResponseHeaders function is called before the response headers are 255 // sent to the client (and before the body is read from the server). Hence this is an opportune time 256 // to disable streaming (oSession.bBufferResponse = true) if there is something in the response headers 257 // which suggests that tampering with the response body is necessary. 258 // 259 // Note: oSession.responseBodyBytes is not available within this function! 260 // 261 static function OnPeekAtResponseHeaders(oSession: Session) { 262 //FiddlerApplication.Log.LogFormat("Session {0}: Response header peek shows status is {1}", oSession.id, oSession.responseCode); 263 if (m_DisableCaching) { 264 oSession.oResponse.headers.Remove("Expires"); 265 oSession.oResponse["Cache-Control"] = "no-cache"; 266 } 267 268 if ((bpStatus>0) && (oSession.responseCode == bpStatus)) { 269 oSession["x-breakresponse"]="status"; 270 oSession.bBufferResponse = true; 271 } 272 273 if ((null!=bpResponseURI) && oSession.uriContains(bpResponseURI)) { 274 oSession["x-breakresponse"]="uri"; 275 oSession.bBufferResponse = true; 276 } 277 278 } 279 280 static function OnBeforeResponse(oSession: Session) { 281 if (m_Hide304s && oSession.responseCode == 304) { 282 oSession["ui-hide"] = "true"; 283 } 284 } 285 286 /* 287 // This function executes just before Fiddler returns an error that it has 288 // itself generated (e.g. "DNS Lookup failure") to the client application. 289 // These responses will not run through the OnBeforeResponse function above. 290 static function OnReturningError(oSession: Session) { 291 } 292 */ 293 /* 294 // This function executes after Fiddler finishes processing a Session, regardless 295 // of whether it succeeded or failed. Note that this typically runs AFTER the last 296 // update of the Web Sessions UI listitem, so you must manually refresh the Session's 297 // UI if you intend to change it. 298 static function OnDone(oSession: Session) { 299 } 300 */ 301 302 /* 303 static function OnBoot() { 304 MessageBox.Show("Fiddler has finished booting"); 305 System.Diagnostics.Process.Start("iexplore.exe"); 306 307 UI.ActivateRequestInspector("HEADERS"); 308 UI.ActivateResponseInspector("HEADERS"); 309 } 310 */ 311 312 /* 313 static function OnBeforeShutdown(): Boolean { 314 // Return false to cancel shutdown. 315 return ((0 == FiddlerApplication.UI.lvSessions.TotalItemCount()) || 316 (DialogResult.Yes == MessageBox.Show("Allow Fiddler to exit?", "Go Bye-bye?", 317 MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2))); 318 } 319 */ 320 321 /* 322 static function OnShutdown() { 323 MessageBox.Show("Fiddler has shutdown"); 324 } 325 */ 326 327 /* 328 static function OnAttach() { 329 MessageBox.Show("Fiddler is now the system proxy"); 330 } 331 */ 332 333 /* 334 static function OnDetach() { 335 MessageBox.Show("Fiddler is no longer the system proxy"); 336 } 337 */ 338 339 // The Main() function runs everytime your FiddlerScript compiles 340 static function Main() { 341 var today: Date = new Date(); 342 FiddlerObject.StatusText = " CustomRules.js was loaded at: " + today; 343 /*david 2018.6.27 add:*/ 344 //请求类型 345 FiddlerObject.UI.lvSessions.AddBoundColumn("HTTPMethod",60,getHTTPMethod ); 346 } 347 static function getHTTPMethod(oS: Session){ 348 if (null != oS.oRequest) return oS.oRequest.headers.HTTPMethod; else return String.Empty; 349 // Uncomment to add a "Server" column containing the response "Server" header, if present 350 /*david 2018.6.27 add:*/ 351 //请求IP 352 FiddlerObject.UI.lvSessions.AddBoundColumn("Server IP", 120, "X-HostIP"); 353 354 // UI.lvSessions.AddBoundColumn("Server", 50, "@response.server"); 355 356 // Uncomment to add a global hotkey (Win+G) that invokes the ExecAction method below... 357 // UI.RegisterCustomHotkey(HotkeyModifiers.Windows, Keys.G, "screenshot"); 358 } 359 360 // These static variables are used for simple breakpointing & other QuickExec rules 361 BindPref("fiddlerscript.ephemeral.bpRequestURI") 362 public static var bpRequestURI:String = null; 363 364 BindPref("fiddlerscript.ephemeral.bpResponseURI") 365 public static var bpResponseURI:String = null; 366 367 BindPref("fiddlerscript.ephemeral.bpMethod") 368 public static var bpMethod: String = null; 369 370 static var bpStatus:int = -1; 371 static var uiBoldURI: String = null; 372 static var gs_ReplaceToken: String = null; 373 static var gs_ReplaceTokenWith: String = null; 374 static var gs_OverridenHost: String = null; 375 static var gs_OverrideHostWith: String = null; 376 377 // The OnExecAction function is called by either the QuickExec box in the Fiddler window, 378 // or by the ExecAction.exe command line utility. 379 static function OnExecAction(sParams: String[]): Boolean { 380 381 FiddlerObject.StatusText = "ExecAction: " + sParams[0]; 382 383 var sAction = sParams[0].toLowerCase(); 384 switch (sAction) { 385 case "bold": 386 if (sParams.Length<2) {uiBoldURI=null; FiddlerObject.StatusText="Bolding cleared"; return false;} 387 uiBoldURI = sParams[1]; FiddlerObject.StatusText="Bolding requests for " + uiBoldURI; 388 return true; 389 case "bp": 390 FiddlerObject.alert("bpu = breakpoint request for uri\nbpm = breakpoint request method\nbps=breakpoint response status\nbpafter = breakpoint response for URI"); 391 return true; 392 case "bps": 393 if (sParams.Length<2) {bpStatus=-1; FiddlerObject.StatusText="Response Status breakpoint cleared"; return false;} 394 bpStatus = parseInt(sParams[1]); FiddlerObject.StatusText="Response status breakpoint for " + sParams[1]; 395 return true; 396 case "bpv": 397 case "bpm": 398 if (sParams.Length<2) {bpMethod=null; FiddlerObject.StatusText="Request Method breakpoint cleared"; return false;} 399 bpMethod = sParams[1].toUpperCase(); FiddlerObject.StatusText="Request Method breakpoint for " + bpMethod; 400 return true; 401 case "bpu": 402 if (sParams.Length<2) {bpRequestURI=null; FiddlerObject.StatusText="RequestURI breakpoint cleared"; return false;} 403 bpRequestURI = sParams[1]; 404 FiddlerObject.StatusText="RequestURI breakpoint for "+sParams[1]; 405 return true; 406 case "bpa": 407 case "bpafter": 408 if (sParams.Length<2) {bpResponseURI=null; FiddlerObject.StatusText="ResponseURI breakpoint cleared"; return false;} 409 bpResponseURI = sParams[1]; 410 FiddlerObject.StatusText="ResponseURI breakpoint for "+sParams[1]; 411 return true; 412 case "overridehost": 413 if (sParams.Length<3) {gs_OverridenHost=null; FiddlerObject.StatusText="Host Override cleared"; return false;} 414 gs_OverridenHost = sParams[1].toLowerCase(); 415 gs_OverrideHostWith = sParams[2]; 416 FiddlerObject.StatusText="Connecting to [" + gs_OverrideHostWith + "] for requests to [" + gs_OverridenHost + "]"; 417 return true; 418 case "urlreplace": 419 if (sParams.Length<3) {gs_ReplaceToken=null; FiddlerObject.StatusText="URL Replacement cleared"; return false;} 420 gs_ReplaceToken = sParams[1]; 421 gs_ReplaceTokenWith = sParams[2].Replace(" ", "%20"); // Simple helper 422 FiddlerObject.StatusText="Replacing [" + gs_ReplaceToken + "] in URIs with [" + gs_ReplaceTokenWith + "]"; 423 return true; 424 case "allbut": 425 case "keeponly": 426 if (sParams.Length<2) { FiddlerObject.StatusText="Please specify Content-Type to retain during wipe."; return false;} 427 UI.actSelectSessionsWithResponseHeaderValue("Content-Type", sParams[1]); 428 UI.actRemoveUnselectedSessions(); 429 UI.lvSessions.SelectedItems.Clear(); 430 FiddlerObject.StatusText="Removed all but Content-Type: " + sParams[1]; 431 return true; 432 case "stop": 433 UI.actDetachProxy(); 434 return true; 435 case "start": 436 UI.actAttachProxy(); 437 return true; 438 case "cls": 439 case "clear": 440 UI.actRemoveAllSessions(); 441 return true; 442 case "g": 443 case "go": 444 UI.actResumeAllSessions(); 445 return true; 446 case "goto": 447 if (sParams.Length != 2) return false; 448 Utilities.LaunchHyperlink("http://www.google.com/search?hl=en&btnI=I%27m+Feeling+Lucky&q=" + Utilities.UrlEncode(sParams[1])); 449 return true; 450 case "help": 451 Utilities.LaunchHyperlink("http://fiddler2.com/r/?quickexec"); 452 return true; 453 case "hide": 454 UI.actMinimizeToTray(); 455 return true; 456 case "log": 457 FiddlerApplication.Log.LogString((sParams.Length<2) ? "User couldn't think of anything to say..." : sParams[1]); 458 return true; 459 case "nuke": 460 UI.actClearWinINETCache(); 461 UI.actClearWinINETCookies(); 462 return true; 463 case "screenshot": 464 UI.actCaptureScreenshot(false); 465 return true; 466 case "show": 467 UI.actRestoreWindow(); 468 return true; 469 case "tail": 470 if (sParams.Length<2) { FiddlerObject.StatusText="Please specify # of sessions to trim the session list to."; return false;} 471 UI.TrimSessionList(int.Parse(sParams[1])); 472 return true; 473 case "quit": 474 UI.actExit(); 475 return true; 476 case "dump": 477 UI.actSelectAll(); 478 UI.actSaveSessionsToZip(CONFIG.GetPath("Captures") + "dump.saz"); 479 UI.actRemoveAllSessions(); 480 FiddlerObject.StatusText = "Dumped all sessions to " + CONFIG.GetPath("Captures") + "dump.saz"; 481 return true; 482 483 default: 484 if (sAction.StartsWith("http") || sAction.StartsWith("www.")) { 485 System.Diagnostics.Process.Start(sParams[0]); 486 return true; 487 } 488 else 489 { 490 FiddlerObject.StatusText = "Requested ExecAction: '" + sAction + "' not found. Type HELP to learn more."; 491 return false; 492 } 493 } 494 } 495 }