fiddler左侧的session列有Result、Protocol、Host、URL、Content-Type等等,但有时候我们可能会遇到这样的场景:我需要知道当前请求与应答服务器的ip,那么,如果给fiddler添加一列“ServerIP”,每一个session都会显示ip,那自然是再好不过了。恰好fiddler就提供这样的功能:
打开Rules->Customize Rules,然后查找字符串static function Main(),在其方法体的最后添加如下一行:
FiddlerObject.UI.lvSessions.AddBoundColumn(“ServerIP”, 120, “X-HostIP”);
整个方法的代码就变为如下:
static function Main() {
var today: Date = new Date();
FiddlerObject.StatusText = " CustomRules.js was loaded at: " + today;
// Uncomment to add a "Server" column containing the response "Server" header, if present
// UI.lvSessions.AddBoundColumn("Server", 50, "@response.server");
// Uncomment to add a global hotkey (Win+G) that invokes the ExecAction method below...
// UI.RegisterCustomHotkey(HotkeyModifiers.Windows, Keys.G, "screenshot");
FiddlerObject.UI.lvSessions.AddBoundColumn("ServerIP", 120, "X-HostIP");
}
设置完毕,重启fiddler,随便访问一个网址看看效果吧!