├── README.md ├── download ├── LinrFiddler-2.6.26.zip ├── LinrFiddler-2.7.24.zip ├── LinrFiddler-2.8.0.zip └── LinrFiddler-2.8.1.zip ├── src └── CustomRules.js └── ui.png /README.md: -------------------------------------------------------------------------------- 1 | # LinrFiddler 2 | =========== 3 | 4 | 5 | 6 | 通过生成自定义脚本,快速配置 Fiddler: 7 | 8 | 1. 文件及目录映射; 9 | 2. 代码注入; 10 | 3. 请求忽略等; 11 | 4. Fiddler 项目管理; 12 | 5. 请求延时; 13 | 6. 列出最近修改的文件; 14 | 15 | ## 下载 Download 16 | 17 | 请在 [Download](https://github.com/Linrstudio/LinrFiddler/blob/master/download/LinrFiddler-2.8.1.zip?raw=true 'Download') 下载 18 | 19 | 2018.5 beta 20 | 21 | ## 视频演示 Video 22 | 23 | http://www.tudou.com/programs/view/KqMm9Gg8ilM/ 24 | 25 | ## 使用方法 How to 26 | 27 | 打开 Fiddler 后,开启 LinrFiddler;第一次使用,请先新建项目; 28 | 29 | ### 新建项目 New Project 30 | 31 | 点击 “New” 方块,进入项目新建页。输入项目名称、hosts 及文件映射,点击保存即可;(除项目名称外其他只有一项可为空) 32 | 33 | ### 修改项目 Config Project 34 | 35 | 在首页,双击项目方块,进入编辑项目状态; 36 | 37 | ### 添加文件映射 38 | 39 | * 在新建或编辑页面,列表为空是单击即可添加本地文件,不为空时双击任意条目,添加本地文件;您也可以拖放多个文件或文件夹至列表; 40 | * 然后选中一条数据,将剪贴板中的网址粘贴即可映射成功; 41 | * 您还可以手动添加映射内容,点击“手动输入”链接,即可进入文本输入模式,请以这种格式输入:EXACT:url 本地路径 42 | 43 | ## 代码注入 44 | 45 | 点击“代码注入”,在输入框中输入想要注入页面的代码,即可。代码会被插入至 </body> 前。 46 | 47 | ## 高级 48 | 49 | 可以在此配置 Fiddler 忽略的数据类型,被忽略的数据不会显示在 Fiddler 列表中。 50 | 51 | ## 配置当前规则 52 | 53 | 当您勾选几个项目后,您可以临时配置 Fiddler 规则。例如仅开启哪几个文件映射; 54 | 55 | ## 开启 Compat Inspector 56 | 57 | 此功能为 微软 IE 团队提供。当你的 Web 要兼容 IE10 时,开启它可以动态检测兼容性并给出改进建议; 58 | -------------------------------------------------------------------------------- /download/LinrFiddler-2.6.26.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Linrstudio/LinrFiddler/9a1e8a4ae4e6ae4771b86f4a9a928e9c0cff6a21/download/LinrFiddler-2.6.26.zip -------------------------------------------------------------------------------- /download/LinrFiddler-2.7.24.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Linrstudio/LinrFiddler/9a1e8a4ae4e6ae4771b86f4a9a928e9c0cff6a21/download/LinrFiddler-2.7.24.zip -------------------------------------------------------------------------------- /download/LinrFiddler-2.8.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Linrstudio/LinrFiddler/9a1e8a4ae4e6ae4771b86f4a9a928e9c0cff6a21/download/LinrFiddler-2.8.0.zip -------------------------------------------------------------------------------- /download/LinrFiddler-2.8.1.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Linrstudio/LinrFiddler/9a1e8a4ae4e6ae4771b86f4a9a928e9c0cff6a21/download/LinrFiddler-2.8.1.zip -------------------------------------------------------------------------------- /src/CustomRules.js: -------------------------------------------------------------------------------- 1 | import System; 2 | import System.Windows.Forms; 3 | import Fiddler; 4 | 5 | // INTRODUCTION 6 | // This is the FiddlerScript Rules file, which creates some of the menu commands and 7 | // other features of Fiddler. You can edit this file to modify or add new commands. 8 | // 9 | // The original version of this file is named SampleRules.js and it is in the 10 | // \Program Files\Fiddler\ folder. When Fiddler first starts, it creates a copy named 11 | // CustomRules.js inside your \Documents\Fiddler2\Scripts folder. If you make a 12 | // mistake in editing this file, simply delete the CustomRules.js file and restart 13 | // Fiddler. A fresh copy of the default rules will be created from the original 14 | // sample rules file. 15 | 16 | // GLOBALIZATION NOTE: 17 | // Be sure to save this file with UTF-8 Encoding if using any non-ASCII characters 18 | // in strings, etc. 19 | 20 | // JScript Reference 21 | // http://www.fiddler2.com/redir/?id=msdnjsnet 22 | // 23 | // FiddlerScript Reference 24 | // http://www.fiddler2.com/redir/?id=fiddlerscriptcookbook 25 | // 26 | // FiddlerScript Editor: 27 | // http://www.fiddler2.com/redir/?id=fiddlerscripteditor 28 | 29 | class Handlers 30 | { 31 | // The following snippet demonstrates a custom-bound column for the web sessions list. 32 | // See http://www.fiddler2.com/fiddler/help/configurecolumns.asp for more info 33 | // public static BindUIColumn("Method", 60) 34 | // function FillMethodColumn(oS: Session){ 35 | // if ((oS.oRequest != null) && (oS.oRequest.headers != null)) 36 | // return oS.oRequest.headers.HTTPMethod; else return String.Empty; 37 | //} 38 | 39 | public static RulesOption("Hide 304s") 40 | var m_Hide304s: boolean = false; 41 | 42 | // Cause Fiddler to override the Accept-Language header with one of the defined values 43 | public static RulesOption("Request &Japanese Content") 44 | var m_Japanese: boolean = false; 45 | 46 | // Automatic Authentication 47 | public static RulesOption("&Automatically Authenticate") 48 | var m_AutoAuth: boolean = false; 49 | 50 | // Cause Fiddler to override the User-Agent header with one of the defined values 51 | RulesString("&User-Agents", true) 52 | RulesStringValue(0,"Netscape &3", "Mozilla/3.0 (Win95; I)") 53 | RulesStringValue(1,"WinPhone7", "Mozilla/4.0 (compatible: MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0; SAMSUNG; SGH-i917)") 54 | RulesStringValue(2,"WinPhone7.5", "Mozilla/5.0 (compatible: MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; SAMSUNG; SGH-i917)") 55 | RulesStringValue(3,"&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") 56 | RulesStringValue(4,"Safari6 (Mac)", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8) AppleWebKit/536.25 (KHTML, like Gecko) Version/6.0 Safari/536.25") 57 | RulesStringValue(5,"iPad", "Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A403 Safari/8536.25") 58 | RulesStringValue(6,"iPhone6", "Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A405 Safari/8536.25") 59 | RulesStringValue(7,"IE &6 (XPSP2)", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)") 60 | RulesStringValue(8,"IE &7 (Vista)", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1)") 61 | RulesStringValue(9,"IE 8 (Win2k3 x64)", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; WOW64; Trident/4.0)") 62 | RulesStringValue(10,"IE &8 (Win7)", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)") 63 | RulesStringValue(11,"IE 8 (IE7 CompatMode)", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0)") 64 | RulesStringValue(12,"IE 9 (Win7)", "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)") 65 | RulesStringValue(13,"IE 10 (Win8)", "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)") 66 | RulesStringValue(14,"&Opera", "Opera/9.80 (Windows NT 6.2; WOW64) Presto/2.12.388 Version/12.10") 67 | RulesStringValue(15,"&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") 68 | RulesStringValue(16,"&Firefox 4", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1") 69 | RulesStringValue(17,"&Firefox 16", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20100101 Firefox/16.0") 70 | RulesStringValue(18,"&Firefox (Mac)", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3") 71 | RulesStringValue(19,"Chrome", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.26 Safari/537.11") 72 | RulesStringValue(20,"GoogleBot Crawler", "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)") 73 | RulesStringValue(21,"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") 74 | RulesStringValue(22,"&Custom...", "%CUSTOM%") 75 | public static var sUA: String = null; 76 | 77 | // Cause Fiddler to delay HTTP traffic to simulate typical 56k modem conditions 78 | public static RulesOption("Simulate &Modem Speeds", "Per&formance") 79 | var m_SimulateModem: boolean = false; 80 | 81 | // Removes HTTP-caching related headers and specifies "no-cache" on requests and responses 82 | public static RulesOption("&Disable Caching", "Per&formance") 83 | var m_DisableCaching: boolean = false; 84 | 85 | // Show the duration between the start of Request.Send and Response.Completed in Milliseconds 86 | public static RulesOption("&Show Time-to-Last-Byte", "Per&formance") 87 | var m_ShowTTLB: boolean = false; 88 | 89 | // Show the time of response completion 90 | public static RulesOption("Show Response &Timestamp", "Per&formance") 91 | var m_ShowTimestamp: boolean = false; 92 | 93 | public static RulesOption("Cache Always &Fresh", "Per&formance") 94 | var m_AlwaysFresh: boolean = false; 95 | 96 | // Force a manual reload of the script file. Resets all 97 | // RulesOption variables to their defaults. 98 | public static ToolsAction("Reset Script") 99 | function DoManualReload() { 100 | FiddlerObject.ReloadScript(); 101 | } 102 | 103 | public static ContextAction("Decode Selected Sessions") 104 | function DoRemoveEncoding(oSessions: Session[]) { 105 | for (var x:int = 0; x < oSessions.Length; x++){ 106 | oSessions[x].utilDecodeRequest(); 107 | oSessions[x].utilDecodeResponse(); 108 | } 109 | FiddlerApplication.UI.actUpdateInspector(true,true); 110 | } 111 | 112 | static function OnBoot() { 113 | // MessageBox.Show("Fiddler has finished booting"); 114 | // System.Diagnostics.Process.Start("iexplore.exe"); 115 | 116 | // FiddlerObject.UI.ActivateRequestInspector("HEADERS"); 117 | // FiddlerObject.UI.ActivateResponseInspector("HEADERS"); 118 | } 119 | 120 | static function OnShutdown() { 121 | // MessageBox.Show("Fiddler has shutdown"); 122 | } 123 | 124 | static function OnAttach() { 125 | // MessageBox.Show("Fiddler is now the system proxy"); 126 | // System.Diagnostics.Process.Start("proxycfg.exe", "-u"); // Notify WinHTTP of proxy change 127 | } 128 | 129 | static function OnDetach() { 130 | // MessageBox.Show("Fiddler is no longer the system proxy"); 131 | // System.Diagnostics.Process.Start("proxycfg.exe", "-u"); // Notify WinHTTP of proxy change 132 | } 133 | 134 | static function ChangeColor(oSession: Session, t, c){ 135 | oSession["ui-" + t] = c; 136 | } 137 | static function EndStr(s){ 138 | return (s != '') ? s.substring(s.length - 1) : ''; 139 | } 140 | 141 | static function GetRegStr(s,t,r){ 142 | r = new RegExp("[.$^{\\[(|)*+?\\\\]", "gi"); 143 | t = s.replace(r, function($1){ 144 | switch($1){ 145 | case "?": 146 | return "(.?)"; 147 | case "*": 148 | return "(.*)"; 149 | default: 150 | return "\\" + $1; 151 | } 152 | }); 153 | return ; 154 | } 155 | 156 | static function AutoMatchs(oSession: Session){ 157 | if (!oSession.HTTPMethodIs("HEAD") && !oSession.HTTPMethodIs("CONNECT")){ 158 | 159 | var ruleRow = [/** linrfiles */]; 160 | var fullUrl = oSession.fullUrl; 161 | 162 | /** LinrFiddler_Hide_images */ 163 | /** LinrFiddler_Hide_css */ 164 | /** LinrFiddler_Hide_js */ 165 | 166 | for (var i = 0, j = ruleRow.length; i < j; ++i){ 167 | var dataArr = ruleRow[i].split('`'); 168 | var uri = dataArr[0]; 169 | var path = dataArr[1]; 170 | var sWillowData = ""; 171 | 172 | if (path != ''){ 173 | if(uri.Length > 7 && uri.StartsWith("Fiddler:")){ 174 | 175 | var sLast = uri.substring(7); 176 | var rStr = GetRegStr(sLast,null,null); 177 | var reg = new RegExp(rStr); 178 | var match = fullUrl.match(reg); 179 | 180 | if (reg.test(fullUrl)){ 181 | var strArr = path.split('?*'); 182 | var targetFile = strArr[0]; 183 | 184 | for (var j = 1; j < strArr.length; ++j){ 185 | targetFile = targetFile + match[j] + strArr[j]; 186 | } 187 | oSession["x-replywithfile"] = targetFile; 188 | 189 | ChangeColor(oSession, "color", "white"); 190 | ChangeColor(oSession, "backcolor", "purple"); 191 | } 192 | 193 | }else if (uri.length > 6 && uri.StartsWith("REGEX:")){ 194 | 195 | var pattern = uri.substring(6); 196 | if(pattern.test(fullUrl)){ 197 | 198 | oSession["x-replywithfile"] = path; 199 | 200 | ChangeColor(oSession, "color", "white"); 201 | ChangeColor(oSession, "backcolor", "purple"); 202 | oSession["ui-customcolumn"] = "正则匹配"; 203 | 204 | } 205 | }else if (uri.length > 6 && uri.StartsWith("EXACT:")){ 206 | 207 | if(uri.indexOf('EXACT:http://host/') != 0){ 208 | if (uri.substring(6) == fullUrl){ 209 | oSession["x-replywithfile"] = path; 210 | ChangeColor(oSession, "color", "white"); 211 | ChangeColor(oSession, "backcolor", "purple"); 212 | oSession["ui-customcolumn"] = "精确匹配"; 213 | } 214 | }else{ 215 | var uripath = fullUrl.substring(fullUrl.lastIndexOf('/') + 1); 216 | var urifilename = uripath.split('?')[0]; 217 | var localpath = path.split('\\'); 218 | var localfilename = localpath.length > 0 ? localpath[localpath.length - 1] : path; 219 | 220 | if(urifilename == localfilename){ 221 | oSession["x-replywithfile"] = path; 222 | ChangeColor(oSession, "color", "yellow"); 223 | ChangeColor(oSession, "backcolor", "purple"); 224 | oSession["ui-customcolumn"] = "模糊匹配"; 225 | } 226 | } 227 | 228 | }else if(uri.length > 6 && uri.StartsWith("DELAY:")){ 229 | var _uri = uri.substring(6); 230 | if(fullUrl.StartsWith(_uri)){ 231 | oSession["response-trickle-delay"] = path; 232 | ChangeColor(oSession, "color", "orange"); 233 | ChangeColor(oSession, "backcolor", "gray"); 234 | oSession["ui-customcolumn"] = "延迟" + path; 235 | } 236 | }else if(uri == '*' || !(EndStr(fullUrl) == '/' && fullUrl.StartsWith("uri"))){ 237 | 238 | if (EndStr(uri) == "/" && EndStr(path) == "\\"){ 239 | 240 | var regex = new RegExp(uri + "[^#?]*"); 241 | if(regex.test(fullUrl)){ 242 | fullUrl = fullUrl.match(regex)[0]; 243 | oSession["x-replywithfile"] = fullUrl.replace(uri, path).replace("/", "\\"); 244 | ChangeColor(oSession, "color", "white"); 245 | ChangeColor(oSession, "backcolor", "#40A62C"); 246 | oSession["ui-customcolumn"] = "目录精确匹配"; 247 | }else{ 248 | var localarr = path.split('\\'), uriarr = fullUrl.split('/'); 249 | if(localarr.length > 1 && uriarr.length > 1){ 250 | var localdir = localarr[localarr.length - 2], uridir = uriarr[uriarr.length - 2],urlname = uriarr[uriarr.length - 1] 251 | if(localdir == uridir){ 252 | oSession["x-replywithfile"] = path + urlname; 253 | ChangeColor(oSession, "color", "pink"); 254 | ChangeColor(oSession, "backcolor", "#40A62C"); 255 | oSession["ui-customcolumn"] = "目录模糊匹配"; 256 | } 257 | } 258 | } 259 | } 260 | } 261 | } 262 | } 263 | } 264 | } 265 | 266 | static function AutoHosts(oSession: Session){ 267 | 268 | var hostList = [/** linrhosts */]; 269 | var hostname = oSession.hostname; 270 | var IPAddressReg = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/; 271 | 272 | for (var i = 0, j = hostList.length, cur, curArr; i < j; ++ i){ 273 | cur = hostList[i]; 274 | curArr = cur.split('`'); 275 | if(curArr.length > 1){ 276 | var host = curArr[1]; 277 | var hostArr = host.split(' '); 278 | var ip = curArr[0]; 279 | for(var k = 0, l = hostArr.length, ahost; k < l; ++ k){ 280 | ahost = hostArr[k]; 281 | if (ahost != '' && IPAddressReg.test(ip) && oSession.HostnameIs(ahost)){ 282 | oSession.bypassGateway = true; 283 | oSession["x-overrideHost"] = ip; 284 | ChangeColor(oSession, "color", "white"); 285 | ChangeColor(oSession, "backcolor", "#A43641"); 286 | } 287 | } 288 | } 289 | } 290 | } 291 | 292 | 293 | static function OnBeforeRequest(oSession: Session) { 294 | // Sample Rule: Color ASPX requests in RED 295 | // if (oSession.uriContains(".aspx")) { oSession["ui-color"] = "red"; } 296 | 297 | // Sample Rule: Flag POSTs to fiddler2.com in italics 298 | // if (oSession.HostnameIs("www.fiddler2.com") && oSession.HTTPMethodIs("POST")) { oSession["ui-italic"] = "yup"; } 299 | 300 | // Sample Rule: Break requests for URLs containing "/sandbox/" 301 | // if (oSession.uriContains("/sandbox/")) { 302 | // oSession.oFlags["x-breakrequest"] = "yup"; // Existence of the x-breakrequest flag creates a breakpoint; the "yup" value is unimportant. 303 | // } 304 | 305 | if ((null != gs_ReplaceToken) && (oSession.url.indexOf(gs_ReplaceToken)>-1)) { // Case sensitive 306 | oSession.url = oSession.url.Replace(gs_ReplaceToken, gs_ReplaceTokenWith); 307 | } 308 | if ((null != gs_OverridenHost) && (oSession.host.toLowerCase() == gs_OverridenHost)) { 309 | oSession["x-overridehost"] = gs_OverrideHostWith; 310 | } 311 | 312 | if ((null!=bpRequestURI) && oSession.uriContains(bpRequestURI)) { 313 | oSession["x-breakrequest"]="uri"; 314 | } 315 | 316 | if ((null!=bpMethod) && (oSession.HTTPMethodIs(bpMethod))) { 317 | oSession["x-breakrequest"]="method"; 318 | } 319 | 320 | if ((null!=uiBoldURI) && oSession.uriContains(uiBoldURI)) { 321 | oSession["ui-bold"]="QuickExec"; 322 | } 323 | 324 | if (m_SimulateModem) { 325 | // Delay sends by 300ms per KB uploaded. 326 | oSession["request-trickle-delay"] = "300"; 327 | // Delay receives by 150ms per KB downloaded. 328 | oSession["response-trickle-delay"] = "150"; 329 | } 330 | 331 | if (m_DisableCaching) { 332 | oSession.oRequest.headers.Remove("If-None-Match"); 333 | oSession.oRequest.headers.Remove("If-Modified-Since"); 334 | oSession.oRequest["Pragma"] = "no-cache"; 335 | } 336 | 337 | // User-Agent Overrides 338 | if (null != sUA) { 339 | oSession.oRequest["User-Agent"] = sUA; 340 | } 341 | 342 | if (m_Japanese) { 343 | oSession.oRequest["Accept-Language"] = "ja"; 344 | } 345 | 346 | if (m_AutoAuth) { 347 | // Automatically respond to any authentication challenges using the 348 | // current Fiddler user's credentials. You can change (default) 349 | // to a domain\\username:password string if preferred. 350 | // 351 | // WARNING: This setting poses a security risk if remote 352 | // connections are permitted! 353 | oSession["X-AutoAuth"] = "(default)"; 354 | } 355 | 356 | if (m_AlwaysFresh && (oSession.oRequest.headers.Exists("If-Modified-Since") || oSession.oRequest.headers.Exists("If-None-Match"))) 357 | { 358 | oSession.utilCreateResponseAndBypassServer(); 359 | oSession.responseCode = 304; 360 | oSession["ui-backcolor"] = "Lavender"; 361 | } 362 | 363 | AutoHosts(oSession); 364 | AutoMatchs(oSession); 365 | } 366 | 367 | // 368 | // If a given session has response streaming enabled, then the OnBeforeResponse function 369 | // is actually called AFTER the response was returned to the client. 370 | // 371 | // In contrast, this OnPeekAtResponseHeaders function is called before the response headers are 372 | // sent to the client (and before the body is read from the server). Hence this is an opportune time 373 | // to disable streaming (oSession.bBufferResponse = true) if there is something in the response headers 374 | // which suggests that tampering with the response body is necessary. 375 | // 376 | // Note: oSession.responseBodyBytes is not available within this function! 377 | // 378 | static function OnPeekAtResponseHeaders(oSession: Session) { 379 | //FiddlerApplication.Log.LogFormat("Session {0}: Response header peek shows status is {1}", oSession.id, oSession.responseCode); 380 | if (m_DisableCaching) { 381 | oSession.oResponse.headers.Remove("Expires"); 382 | oSession.oResponse["Cache-Control"] = "no-cache"; 383 | } 384 | 385 | if ((bpStatus>0) && (oSession.responseCode == bpStatus)) { 386 | oSession["x-breakresponse"]="status"; 387 | oSession.bBufferResponse = true; 388 | } 389 | 390 | if ((null!=bpResponseURI) && oSession.uriContains(bpResponseURI)) { 391 | oSession["x-breakresponse"]="uri"; 392 | oSession.bBufferResponse = true; 393 | } 394 | 395 | } 396 | 397 | static function OnBeforeResponse(oSession: Session) { 398 | if (m_ShowTimestamp){ 399 | oSession["ui-customcolumn"] = DateTime.Now.ToString("H:mm:ss.ffff") + " " + oSession["ui-customcolumn"]; 400 | } 401 | 402 | if (m_ShowTTLB){ 403 | oSession["ui-customcolumn"] = oSession.oResponse.iTTLB + "ms " + oSession["ui-customcolumn"]; 404 | } 405 | 406 | if (m_Hide304s && oSession.responseCode == 304){ 407 | oSession["ui-hide"] = "true"; 408 | } 409 | 410 | /** LinrFiddler_Compat_Inspector */ 411 | } 412 | 413 | /* 414 | // This function executes just before Fiddler returns an error that it has 415 | // itself generated (e.g. "DNS Lookup failure") to the client application. 416 | // These responses will not run through the OnBeforeResponse function above. 417 | static function OnReturningError(oSession: Session) { 418 | } 419 | */ 420 | 421 | static function Main() { 422 | var today: Date = new Date(); 423 | FiddlerObject.StatusText = " CustomRules.js was loaded at: " + today; 424 | 425 | if(!FiddlerApplication.UI.tabsViews.TabPages.ContainsKey('LinrFidderTab')){ 426 | var oPage = new TabPage("项目管理"); 427 | oPage.Name = 'LinrFidderTab'; 428 | oPage.ImageIndex = 13; 429 | var btn = new Button(); 430 | btn.Width = 180; 431 | btn.Text = "打开 LinrFiddler"; 432 | oPage.Controls.Add(btn); 433 | btn.add_Click(LinrFidderClicked); 434 | FiddlerApplication.UI.tabsViews.TabPages.Add(oPage); 435 | } 436 | // Uncomment to add a "Server" column containing the response "Server" header, if present 437 | // FiddlerObject.UI.lvSessions.AddBoundColumn("Server", 50, "@response.server"); 438 | } 439 | 440 | static function LinrFidderClicked(sender, e:EventArgs){ 441 | System.Diagnostics.Process.Start('C:\\LinrFiddler\\' + "LinrFiddler.exe"); 442 | } 443 | 444 | // These static variables are used for simple breakpointing & other QuickExec rules 445 | static var bpRequestURI:String = null; 446 | static var bpResponseURI:String = null; 447 | static var bpStatus:int = -1; 448 | static var bpMethod: String = null; 449 | static var uiBoldURI: String = null; 450 | static var gs_ReplaceToken: String = null; 451 | static var gs_ReplaceTokenWith: String = null; 452 | static var gs_OverridenHost: String = null; 453 | static var gs_OverrideHostWith: String = null; 454 | 455 | // The OnExecAction function is called by either the QuickExec box in the Fiddler window, 456 | // or by the ExecAction.exe command line utility. 457 | static function OnExecAction(sParams: String[]) { 458 | 459 | FiddlerObject.StatusText = "ExecAction: " + sParams[0]; 460 | 461 | var sAction = sParams[0].toLowerCase(); 462 | switch (sAction) { 463 | case "bold": 464 | if (sParams.Length<2) {uiBoldURI=null; FiddlerObject.StatusText="Bolding cleared"; return;} 465 | uiBoldURI = sParams[1]; FiddlerObject.StatusText="Bolding requests for " + uiBoldURI; 466 | break; 467 | case "bp": 468 | FiddlerObject.alert("bpu = breakpoint request for uri\nbpm = breakpoint request method\nbps=breakpoint response status\nbpafter = breakpoint response for URI"); 469 | break; 470 | case "bps": 471 | if (sParams.Length<2) {bpStatus=-1; FiddlerObject.StatusText="Response Status breakpoint cleared"; return;} 472 | bpStatus = parseInt(sParams[1]); FiddlerObject.StatusText="Response status breakpoint for " + sParams[1]; 473 | break; 474 | case "bpv": 475 | case "bpm": 476 | if (sParams.Length<2) {bpMethod=null; FiddlerObject.StatusText="Request Method breakpoint cleared"; return;} 477 | bpMethod = sParams[1].toUpperCase(); FiddlerObject.StatusText="Request Method breakpoint for " + bpMethod; 478 | break; 479 | case "bpu": 480 | if (sParams.Length<2) {bpRequestURI=null; FiddlerObject.StatusText="RequestURI breakpoint cleared"; return;} 481 | bpRequestURI = sParams[1]; 482 | FiddlerObject.StatusText="RequestURI breakpoint for "+sParams[1]; 483 | break; 484 | case "bpafter": 485 | if (sParams.Length<2) {bpResponseURI=null; FiddlerObject.StatusText="ResponseURI breakpoint cleared"; return;} 486 | bpResponseURI = sParams[1]; 487 | FiddlerObject.StatusText="ResponseURI breakpoint for "+sParams[1]; 488 | break; 489 | case "overridehost": 490 | if (sParams.Length<3) {gs_OverridenHost=null; FiddlerObject.StatusText="Host Override cleared"; return;} 491 | gs_OverridenHost = sParams[1].toLowerCase(); 492 | gs_OverrideHostWith = sParams[2]; 493 | FiddlerObject.StatusText="Connecting to [" + gs_OverrideHostWith + "] for requests to [" + gs_OverridenHost + "]"; 494 | break; 495 | case "urlreplace": 496 | if (sParams.Length<3) {gs_ReplaceToken=null; FiddlerObject.StatusText="URL Replacement cleared"; return;} 497 | gs_ReplaceToken = sParams[1]; 498 | gs_ReplaceTokenWith = sParams[2].Replace(" ", "%20"); // Simple helper 499 | FiddlerObject.StatusText="Replacing [" + gs_ReplaceToken + "] in URIs with [" + gs_ReplaceTokenWith + "]"; 500 | break; 501 | case "allbut": 502 | case "keeponly": 503 | if (sParams.Length<2) { FiddlerObject.StatusText="Please specify Content-Type to retain during wipe."; return;} 504 | FiddlerObject.UI.actSelectSessionsWithResponseHeaderValue("Content-Type", sParams[1]); 505 | FiddlerObject.UI.actRemoveUnselectedSessions(); 506 | FiddlerObject.UI.lvSessions.SelectedItems.Clear(); 507 | FiddlerObject.StatusText="Removed all but Content-Type: " + sParams[1]; 508 | break; 509 | case "stop": 510 | FiddlerObject.UI.actDetachProxy(); 511 | break; 512 | case "start": 513 | FiddlerObject.UI.actAttachProxy(); 514 | break; 515 | case "cls": 516 | case "clear": 517 | FiddlerObject.UI.actRemoveAllSessions(); 518 | break; 519 | case "g": 520 | case "go": 521 | FiddlerObject.UI.actResumeAllSessions(); 522 | break; 523 | case "goto": 524 | if (sParams.Length != 2) return; 525 | Utilities.LaunchHyperlink("http://www.google.com/search?hl=en&btnI=I%27m+Feeling+Lucky&q=" + Utilities.UrlEncode(sParams[1])); 526 | break; 527 | case "help": 528 | Utilities.LaunchHyperlink("http://www.fiddler2.com/redir/?id=quickexec"); 529 | break; 530 | case "hide": 531 | FiddlerObject.UI.actMinimizeToTray(); 532 | break; 533 | case "log": 534 | FiddlerApplication.Log.LogString((sParams.Length<2) ? FiddlerApplication.Log.LogString("User couldn't think of anything to say...") : sParams[1]); 535 | break; 536 | case "nuke": 537 | FiddlerObject.UI.actClearWinINETCache(); 538 | FiddlerObject.UI.actClearWinINETCookies(); 539 | break; 540 | case "show": 541 | FiddlerObject.UI.actRestoreWindow(); 542 | break; 543 | case "tail": 544 | if (sParams.Length<2) { FiddlerObject.StatusText="Please specify # of sessions to trim the session list to."; return;} 545 | FiddlerObject.UI.TrimSessionList(int.Parse(sParams[1])); 546 | break; 547 | case "quit": 548 | FiddlerObject.UI.actExit(); 549 | break; 550 | case "dump": 551 | FiddlerObject.UI.actSelectAll(); 552 | FiddlerObject.UI.actSaveSessionsToZip(CONFIG.GetPath("Captures") + "dump.saz"); 553 | FiddlerObject.UI.actRemoveAllSessions(); 554 | FiddlerObject.StatusText = "Dumped all sessions to " + CONFIG.GetPath("Captures") + "dump.saz"; 555 | break; 556 | 557 | default: 558 | if (sAction.StartsWith("http") || sAction.StartsWith("www")){ 559 | System.Diagnostics.Process.Start(sParams[0]); 560 | } 561 | else 562 | { 563 | FiddlerObject.StatusText = "Requested ExecAction: '" + sAction + "' not found. Type HELP to learn more."; 564 | } 565 | } 566 | } 567 | 568 | /** LinrFiddler_Compat_Inspector_Script */ 569 | } -------------------------------------------------------------------------------- /ui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Linrstudio/LinrFiddler/9a1e8a4ae4e6ae4771b86f4a9a928e9c0cff6a21/ui.png --------------------------------------------------------------------------------