美文网首页
fiddler script

fiddler script

作者: 海滨小城 | 来源:发表于2014-11-24 15:02 被阅读0次

static function OnBeforeRequest(oSession: Session) {
// Sample Rule: Color ASPX requests in RED
// if (oSession.uriContains(".aspx")) { oSession["ui-color"] = "red"; }

    // Sample Rule: Flag POSTs to fiddler2.com in italics
    // if (oSession.HostnameIs("www.fiddler2.com") && oSession.HTTPMethodIs("POST")) {  oSession["ui-italic"] = "yup";  }

    // Sample Rule: Break requests for URLs containing "/sandbox/"
    // if (oSession.uriContains("/sandbox/")) {
    //     oSession.oFlags["x-breakrequest"] = "yup";   // Existence of the x-breakrequest flag creates a breakpoint; the "yup" value is unimportant.
    // }

    if ((null != gs_ReplaceToken) && (oSession.url.indexOf(gs_ReplaceToken)>-1)) {   // Case sensitive
        oSession.url = oSession.url.Replace(gs_ReplaceToken, gs_ReplaceTokenWith); 
    }
    if ((null != gs_OverridenHost) && (oSession.host.toLowerCase() == gs_OverridenHost)) {
        oSession["x-overridehost"] = gs_OverrideHostWith; 
    }

    if ((null!=bpRequestURI) && oSession.uriContains(bpRequestURI)) {
        oSession["x-breakrequest"]="uri";
    }

    if ((null!=bpMethod) && (oSession.HTTPMethodIs(bpMethod))) {
        oSession["x-breakrequest"]="method";
    }

    if ((null!=uiBoldURI) && oSession.uriContains(uiBoldURI)) {
        oSession["ui-bold"]="QuickExec";
    }

    if (m_SimulateModem) {
        // Delay sends by 300ms per KB uploaded.
        oSession["request-trickle-delay"] = "300"; 
        // Delay receives by 150ms per KB downloaded.
        oSession["response-trickle-delay"] = "150"; 
    }

    if (m_DisableCaching) {
        oSession.oRequest.headers.Remove("If-None-Match");
        oSession.oRequest.headers.Remove("If-Modified-Since");
        oSession.oRequest["Pragma"] = "no-cache";
    }

    // User-Agent Overrides
    if (null != sUA) {
        oSession.oRequest["User-Agent"] = sUA; 
    }

    if (m_Japanese) {
        oSession.oRequest["Accept-Language"] = "ja";
    }
    
if(oSession.uriContains( "b.paipai.com/dealdetail/view" ))
{

        
oSession["ui-color"]="green";
oSession["ui-bold"]="green";

oSession["x-replywithfile"]="G:\\订单数据.txt";
}

       
    
    if(oSession.uriContains( "b.paipai.com/deallist/AllDealList" ))
    {

        
        oSession["ui-color"]="green";
        oSession["ui-bold"]="green";

        oSession["x-replywithfile"]="G:\\订单列表.txt";

       
    }
    

    if (m_AutoAuth) {
        // Automatically respond to any authentication challenges using the 
        // current Fiddler user's credentials. You can change (default)
        // to a domain\\username:password string if preferred.
        //
        // WARNING: This setting poses a security risk if remote 
        // connections are permitted!
        oSession["X-AutoAuth"] = "(default)";
    }

    if (m_AlwaysFresh && (oSession.oRequest.headers.Exists("If-Modified-Since") || oSession.oRequest.headers.Exists("If-None-Match")))
    {
        oSession.utilCreateResponseAndBypassServer();
        oSession.responseCode = 304;
        oSession["ui-backcolor"] = "Lavender";
    }
}

相关文章

网友评论

      本文标题:fiddler script

      本文链接:https://www.haomeiwen.com/subject/ituwtttx.html