官方版
Search Sequential Pages for Target String
To search for a target string on a series of successively named HTML pages (for example, to find the first page containing “TargetString” from 1.htm, 2.htm, 3.htm, 4.htm, etc.), add rules to Fiddler as follows:
Add a rule to Fiddler with Global scope to create a new menu item as follows:
public static ToolsAction("Find page containing search string")function doGrab(){var s = "GET /gallery/image1.htm HTTP/1.1\r\nHost: www.example.com\r\nX-My-Num: 1\r\n\r\n";try{FiddlerObject.utilIssueRequest(s);}catch(e){MessageBox.Show("send failed" + e.ToString());}}
This will generate the first request. Note: Because the utilIssueRequest call is asynchronous, you don’t get the response directly.
- Add a rule to Fiddler in the OnBeforeResponse function as follows:
if (oSession.oRequest.headers.Exists("X-My-Num")){// This is a response to my Grab code...if (oSession.utilFindInResponse("targetstring", false) > -1){// If the index of the target string is >-1, we found the search string...MessageBox.Show("Found target string!");}else{//didn't find the target string. increment the number.var n = int.parse(oSession.oRequest["X-My-Num"]);n++;var s = "GET /gallery/image" + n.ToString() + ".htm HTTP/1.1\r\nHost: http://www.example.com\r\nX-My-Num: "+ n.ToString() + "\r\n\r\n";try{// Make a recursive HTTP request for the next item.FiddlerObject.utilIssueRequest(s);}catch(e){MessageBox.Show("send failed" + e.ToString());}}}
谷歌翻译版
在顺序页面中搜索目标字符串
要在一系列连续命名的HTML页面上搜索目标字符串(例如,从1.htm,2.htm,3.htm,4.htm等中查找包含“ TargetString”的第一页),请添加规则 给Fiddler的方法如下:
将规则添加到具有全局范围的Fiddler来创建一个新菜单项,如下所示:
public static ToolsAction("Find page containing search string")function doGrab(){var s = "GET /gallery/image1.htm HTTP/1.1\r\nHost: www.example.com\r\nX-My-Num: 1\r\n\r\n";try{FiddlerObject.utilIssueRequest(s);}catch(e){MessageBox.Show("send failed" + e.ToString());}}
这将生成第一个请求。 注意:由于utilIssueRequest调用是异步的,因此您不会直接获得响应。
- 在OnBeforeResponse函数中向Fiddler添加一个规则,如下所示:
if (oSession.oRequest.headers.Exists("X-My-Num")){// This is a response to my Grab code...if (oSession.utilFindInResponse("targetstring", false) > -1){// If the index of the target string is >-1, we found the search string...MessageBox.Show("Found target string!");}else{//didn't find the target string. increment the number.var n = int.parse(oSession.oRequest["X-My-Num"]);n++;var s = "GET /gallery/image" + n.ToString() + ".htm HTTP/1.1\r\nHost: http://www.example.com\r\nX-My-Num: "+ n.ToString() + "\r\n\r\n";try{// Make a recursive HTTP request for the next item.FiddlerObject.utilIssueRequest(s);}catch(e){MessageBox.Show("send failed" + e.ToString());}}}
