版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wuchenlhy/article/details/81085179
第一步:
打开fiddler 找到Fiddler Script
第二步:
找到OnBeforeResponse方法
再方法中添加如下代码
oSession.utilDecodeResponse();//消除保存的请求可能存在乱码的情况
var now = new Date();
var ts = now.getTime();//获取当前时间戳
//oSession.SaveSession("D:/fiddlerSession/" + ts + "_" + oSession.id + ".txt",false);//保存完整session到指定路径
var filename = "D:/fiddlerSession/" + ts + "_" + oSession.id + ".txt";
var curDate = new Date();
var logContent = "Request url: " + oSession.url + "\r\nRequest body: " + oSession.GetRequestBodyAsString() + "\r\nResponse body: " + oSession.GetResponseBodyAsString() + "\r\n";//保存url 请求参数 相应数据
var sw : System.IO.StreamWriter;
if (System.IO.File.Exists(filename)){
sw = System.IO.File.AppendText(filename);
sw.Write(logContent);
}
else{
sw = System.IO.File.CreateText(filename);
sw.Write(logContent);
}
sw.Close();
sw.Dispose();
第三步:
保存fiddlerScrpit
不用重新启动fiddler,新抓到包的session已经保存到我们指定的文件中了
扫描二维码关注公众号,回复:
3646676 查看本文章