向指定链接发送指定文本
import System.Web;
//发送指定请求
if (!oSession.fullUrl.Contains("127.0.0.1"))
{
//var url = oSession.url;
var url = oSession.fullUrl;//包含协议http/s
var method = oSession.oRequest.headers.HTTPMethod;
var headers = oSession.oRequest.headers;
var body = oSession.GetRequestBodyAsString();
//headers = headers.ToString().Replace("\r", "#").Replace("\n", "#");
headers = headers.ToString().Replace(" ", "");
headers = System.Web.HttpUtility.UrlEncode(headers,System.Text.Encoding.UTF8).Replace("+", "%20");
//body = body.ToString().Replace("\"", "\\\"").Replace("\r", "").Replace("\n", "");
body = body.ToString().Replace(" ", "");//移除空格
//UrlEncode 会把空格转换成+号
body = System.Web.HttpUtility.UrlEncode(body,System.Text.Encoding.UTF8).Replace("+", "%20");
var data = "\{\"url\":\""+url+"\",\"method\":\""+method+"\",\"headers\":\""+headers+"\",\"body\":\""+body+"\"\}";
data = System.Web.HttpUtility.UrlEncode(data,System.Text.Encoding.UTF8);
var s = "POST http://127.0.0.1:8080/CrawlerScanner/dzp/rec?data="+data+" HTTP/1.1\r\n\r\n";
try{
FiddlerObject.utilIssueRequest(s);
}
catch(e){
MessageBox.Show("send failed" + e.ToString());
}
}
fiddle使用自定义js修改返回结果
//插入自定义内容-根据host判断
if (oSession.HostnameIs("www.taobao.com") && oSession.oResponse.headers.ExistsAndContains("Content-Type","text/html")){
oSession.utilDecodeResponse();
oSession.utilReplaceInResponse('<head>','<head><script>alert(document.cookie);</script>');
}
//插入自定义内容-根据url判断
if (oSession.uriContains(".taobao.com") && oSession.oResponse.headers.ExistsAndContains("Content-Type","text/html")){
oSession.utilDecodeResponse();
oSession.utilReplaceInResponse('<head>','<head><script>alert(document.cookie);</script>');