回到顶部

CONTENTS

Fiddler Customize Rules create get or post request 创建请求

Fiddler Customize Rules create get request:

https://docs.telerik.com/fiddler/Generate-Traffic/Tasks/SearchSequentialPages

例子

static function OnBeforeResponse(oSession: Session) {

    // 状态码为 502、500、404 的发钉钉提醒
    var errorCodes = "502500404";
    var responseCode = oSession.responseCode.ToString()
    var pattern = new RegExp(responseCode);

    if(oSession.hostname.Contains("xieboke.net") && pattern.test(errorCodes) ){
            var key="";
            var request_body = oSession.GetRequestBodyAsString().replace(/"/g,"'");
            var content ="[" + oSession.responseCode + "]" + oSession.oRequest.headers + "\n" + request_body;
            //MessageBox.Show(content)
            //钉钉机器人地址
            var dingding_hook = "https://oapi.dingtalk.com/robot/send?access_token=xxxxxxx"
            var user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"
            var body = '{"msgtype": "text","text": {"content": "' + content + '"}}'
            var body_length = body.length + 4;

            //var rg = "GET https://xieboke.net/ HTTP/1.1\r\nUser-Agent:" + user_agent + "\r\nHost: xieboke.net\r\nReferer:https://xieboke.net/\r\n\r\n";

            var method = "POST";
            var myUrl = dingding_hook;
            var url = myUrl;
            var protocol = "HTTP/1.1";
            var raw="";

            raw += method + " " + url + " " + protocol + "\r\n";
            raw += "User-Agent:" + user_agent + "\r\n";
            raw += "Content-Length:" + body_length + "\r\n";
            raw += "Content-Type:application/json" + "\r\n\r\n";
            raw += "\r\n" + body + "\r\n\r\n";
            //MessageBox.Show(raw)

            try{ 
                // Make a recursive HTTP request for the next item.
                // 接口请求信息发送到钉钉
                FiddlerObject.utilIssueRequest(raw); 
            } 
            catch(e){ 
                MessageBox.Show(e.ToString()); 
            } 
            
        }

}

效果图

因为 post 请求时,缺少 csrf 验证,被 Django 拒了(WARNING Forbidden (CSRF cookie not set.): /)

当满足某种条件时,向 钉钉发送 请求的信息

^_^
请喝咖啡 ×

前一篇: Fiddler ModifyAutoresponder 修改匹配规则
下一篇: 分享一款 windows 下的截屏工具 Screenshot_ServerTask