Ejemplo n.º 1
0
 private void FiddlerApplication_AfterSessionComplete(Fiddler.Session oSession)
 {
     //取り敢えずログを吐く
     Console.WriteLine(string.Format("Session {0}({3}):HTTP {1} for {2}",
                                     oSession.id, oSession.responseCode, oSession.fullUrl, oSession.oResponse.MIMEType));
     sessionhandle(oSession);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 用文件替代response
        /// </summary>
        /// <param name="session"></param>
        /// <param name="path"></param>
        public static void LoadFileToResponse(Fiddler.Session session, string path)
        {
            var ct  = "text/html; charset=utf-8";
            var ext = System.IO.Path.GetExtension(path);

            //FiddlerLog("file ext:" + ext);
            if (".gif,.png,.jpg,.bmp,.jpeg,.webp".IndexOf(ext, StringComparison.OrdinalIgnoreCase) > -1)
            {
                ct = "image/" + ext.TrimStart('.');
            }

            if (System.IO.File.Exists(path))
            {
                ResetResponse(session, 200, ct);
                //var content = System.IO.File.ReadAllText(path, System.Text.Encoding.UTF8);
                //session.utilSetResponseBody(content);

                session.oResponse.headers.Add("jmFidExt_action", path);

                session.LoadResponseFromFile(path);
            }
            else
            {
                ResetResponse(session, 404, ct);
                session.utilSetResponseBody("文件:" + path + " 未找到");
            }
            //session.Ignore();
        }
        public PassiveCheckResult RunCheck(Fiddler.Session fiddlerSession)
        {
            if (fiddlerSession.isHTTPS && fiddlerSession.oResponse.headers.Exists("set-cookie"))
            {
                string cookie = fiddlerSession.oResponse.headers["set-cookie"];

                if (cookie != null && cookie.Length > 0)
                {
                    string[] parts      = cookie.Split(';');
                    string   cookiename = parts[0];
                    cookiename = cookiename.Split('=')[0];

                    if (parts != null && parts.Length > 0)
                    {
                        bool isDomainSet = false;

                        parts.ForEach(v =>
                        {
                            if (v.Trim().ToLower().StartsWith("domain"))
                            {
                                isDomainSet = true;
                            }
                        });

                        if (!isDomainSet)
                        {
                            return(PassiveCheckResult.CreateFailure(this, fiddlerSession.fullUrl, "Cookie not marked with domain"));
                        }
                    }
                }
            }

            return(PassiveCheckResult.CreatePass(this, fiddlerSession.fullUrl));
        }
Ejemplo n.º 4
0
        void guildname(Fiddler.Session oSession)
        {
            var a = oSession.GetResponseBodyAsString();

            Console.WriteLine(a);
            var test = DynamicJson.Parse(a);

            GlobalVar.guildname    = "," + test.guild_name;
            GlobalVar.lupi         = test.most_donated_lupi;
            GlobalVar.url          = "http://game.granbluefantasy.jp/#guild/detail/" + test.guild_id;
            GlobalVar.guildidcheck = test.guild_id;

            writeGuildname(test.guild_name);
            GlobalVar.mainpage = true;

            //初期化
            GlobalVar.totalrank = 0;
            GlobalVar.member    = 0;
            GlobalVar.page1     = false;
            GlobalVar.page2     = false;
            GlobalVar.page3     = false;
            GlobalVar.checker   = 0;

            if (hikoukaidan.check == false)
            {
                writeGuildnum("");
                writeARank("");
            }
        }
Ejemplo n.º 5
0
        public static Session CreateSessionFromRequestString(string RequestString)
        {
            Fiddler.Session Sess = Session.CreateFiddlerSessionFromRequestString(RequestString);
            Session         IrSe = new Session(Sess);

            return(IrSe);
        }
Ejemplo n.º 6
0
 internal Request(Fiddler.Session Sess)
 {
     this.InitiateParameters();
     if (Sess.oFlags.ContainsKey("IronFlag-ID"))
     {
         this.ID = Int32.Parse(Sess.oFlags["IronFlag-ID"]);
     }
     if (Sess.oFlags.ContainsKey("IronFlag-ScanID"))
     {
         this.ScanID = Int32.Parse(Sess.oFlags["IronFlag-ScanID"]);
     }
     if (Sess.oFlags.ContainsKey("IronFlag-Ticks"))
     {
         this.TimeObject = new DateTime(long.Parse(Sess.oFlags["IronFlag-Ticks"]));
     }
     if (Sess.oFlags.ContainsKey("IronFlag-BuiltBy"))
     {
         if (Sess.oFlags["IronFlag-BuiltBy"] == "ManualTestingSection")
         {
             this.Source = RequestSource.Test;
         }
     }
     this.AbsorbFullURL(Sess.fullUrl);
     this.Method = Sess.oRequest.headers.HTTPMethod;
     foreach (Fiddler.HTTPHeaderItem HHI in Sess.oRequest.headers)
     {
         this.Headers.Add(HHI.Name, HHI.Value);
     }
     this.SetBody(Sess.requestBodyBytes);
 }
        public void AddRequest(Fiddler.Session req, string stepName)
        {
            bool isPrimary = SessionUtils.IsPrimaryReq(req);
            var  reqCode   = new RequestSection(req, ParentScript, stepName, ParentScript.ParametrizedValues, isPrimary);

            _sections.Add(reqCode);
        }
Ejemplo n.º 8
0
        private void FiddlerApplication_BeforeRequest(Fiddler.Session oSession)
        {
            Utility.Configuration.ConfigurationData.ConfigConnection c = Utility.Configuration.Config.Connection;


            // 上流プロキシ設定
            if (c.UseUpstreamProxy)
            {
                oSession["X-OverrideGateway"] = string.Format("localhost:{0}", c.UpstreamProxyPort);
            }


            if (oSession.fullUrl.Contains("/kcsapi/"))
            {
                string url  = oSession.fullUrl;
                string body = oSession.GetRequestBodyAsString();

                //保存
                {
                    if (c.SaveReceivedData && c.SaveRequest)
                    {
                        Task.Run((Action)(() => {
                            SaveRequest(url, body);
                        }));
                    }
                }

                UIControl.BeginInvoke((Action)(() => { LoadRequest(url, body); }));
            }
        }
 private void FiddlerSessionComplete(Fiddler.Session session)
 {
     lock (session)
     {
         _sessions.Add(session);
     }
 }
Ejemplo n.º 10
0
        private void FiddlerApplication_BeforeResponse(Fiddler.Session oSession)
        {
            //flash 品質設定
            if (oSession.bBufferResponse && oSession.fullUrl.Contains("/gadget/js/kcs_flash.js"))
            {
                string js   = oSession.GetResponseBodyAsString();
                bool   flag = false;

                var wmode = _wmodeRegex.Match(js);
                if (wmode.Success)
                {
                    js   = js.Replace(wmode.Value, string.Format(@"""wmode"":""{0}""", Utility.Configuration.Config.FormBrowser.FlashWMode));
                    flag = true;
                }

                var quality = _qualityRegex.Match(js);
                if (quality.Success)
                {
                    js   = js.Replace(quality.Value, string.Format(@"""quality"":""{0}""", Utility.Configuration.Config.FormBrowser.FlashQuality));
                    flag = true;
                }

                if (flag)
                {
                    oSession.utilSetResponseBody(js);

                    Utility.Logger.Add(1, "flashの品質設定を行いました。");
                }
            }
        }
Ejemplo n.º 11
0
 public HttpRequestLine(Fiddler.Session sess)
 {
     Method          = sess.RequestMethod;
     ProtocolVersion = sess.RequestHeaders.HTTPVersion;
     URI             = sess.fullUrl;
     RequestLine     = string.Format("{0} {1} {2}", Method, URI, ProtocolVersion);
 }
Ejemplo n.º 12
0
 private static void OverrideStylesheet_BeforeRequest(Fiddler.Session oSession)
 {
     if (oSession.fullUrl != Properties.Settings.Default.KanColleGamePage.AbsoluteUri)
     {
         return;
     }
     oSession.bBufferResponse = true;
 }
Ejemplo n.º 13
0
 private static void QualityScript_BeforeRequest(Fiddler.Session oSession)
 {
     if (!oSession.url.Contains("osapi.dmm.com/gadgets/ifr?"))
     {
         return;
     }
     oSession.bBufferResponse = true;
 }
 internal ValidateServerCertificateEventArgs(Fiddler.Session inSession, string inExpectedCN, X509Certificate inServerCertificate, X509Chain inServerCertificateChain, SslPolicyErrors inSslPolicyErrors)
 {
     this._oSession = inSession;
     this._sExpectedCN = inExpectedCN;
     this._oServerCertificate = inServerCertificate;
     this._ServerCertificateChain = inServerCertificateChain;
     this._sslPolicyErrors = inSslPolicyErrors;
 }
Ejemplo n.º 15
0
 public Session(Fiddler.Session _FiddlerSession)
 {
     this.FiddlerSession = _FiddlerSession;
     this.Request        = new Request(this.FiddlerSession);
     if (this.FiddlerSession.bHasResponse)
     {
         this.Response = new Response(this.FiddlerSession);
     }
 }
Ejemplo n.º 16
0
 private static void OverrideStylesheet_BeforeResponse(Fiddler.Session oSession)
 {
     if (oSession.fullUrl != Properties.Settings.Default.KanColleGamePage.AbsoluteUri)
     {
         return;
     }
     oSession.utilDecodeResponse();
     oSession.utilReplaceInResponse("</head>", Properties.Settings.Default.TagOverrideStylesheet + "</head>");
 }
Ejemplo n.º 17
0
 public Session(Fiddler.Session _FiddlerSession)
 {
     this.FiddlerSession = _FiddlerSession;
     this.Request = new Request(this.FiddlerSession);
     if (this.FiddlerSession.bHasResponse)
     {
         this.Response = new Response(this.FiddlerSession);
     }
 }
Ejemplo n.º 18
0
 public Session(Fiddler.Session _FiddlerSession)
 {
     this.FiddlerSession = _FiddlerSession;
     this.Request        = new Request(this.FiddlerSession);
     try
     {
         this.Response = new Response(this.FiddlerSession);
     }
     catch { }
 }
Ejemplo n.º 19
0
        /// <summary>
        /// 重置请求response
        /// </summary>
        /// <param name="session"></param>
        /// <param name="status"></param>
        /// <param name="contentType"></param>
        public static void ResetResponse(Fiddler.Session session, int status = 200, string contentType = "text/html; charset=utf-8")
        {
            //伪造response
            session.utilCreateResponseAndBypassServer();
            session.oResponse.headers.SetStatus(status, "By jmFidExt");

            session.oResponse["Content-Type"] = contentType;

            session.oResponse["Date"] = DateTime.Now.ToUniversalTime().ToString("r");
        }
Ejemplo n.º 20
0
        public static string GeneratePythonCode(Fiddler.Session session)
        {
            var requestMethod = session.RequestMethod.ToLower();
            var fullUrl       = session.fullUrl;

            StringBuilder sb = new StringBuilder();

            WriteLine(sb, "import requests");

            WriteLine(sb, "headers = {}");
            foreach (var header in session.RequestHeaders)
            {
                if (header.Name.ToLower() == "cookie")
                {
                    // cookies will be handled differently
                    continue;
                }
                WriteLine(sb, string.Format($"headers['{header.Name}'] = '{header.Value}'", header.Name, header.Value));
            }


            WriteLine(sb, "cookies = {}");

            if (session.RequestHeaders["Cookie"] != null)
            {
                WriteLine(sb, "jar = requests.cookies.RequestsCookieJar()");

                CookieContainer cookieContainer = new CookieContainer();
                var             uri             = new Uri(session.fullUrl);

                // .Net CookieContainer has a stupid bug where it expects comma instead of semi-column as a delimiter
                cookieContainer.SetCookies(uri, session.RequestHeaders["Cookie"].Replace(";", ","));

                foreach (Cookie cookie in cookieContainer.GetCookies(uri))
                {
                    string name  = cookie.Name;
                    string value = cookie.Value;
                    WriteLine(sb, string.Format($"jar.set('{name}','{value}')", name, value));
                }
            }

            if (requestMethod == "post")
            {
                var payload = UnicodeEncoding.UTF8.GetString(session.RequestBody);
                WriteLine(sb, string.Format($"data = b'{payload}'", payload));
            }
            else
            {
                WriteLine(sb, "data = {}");
            }

            WriteLine(sb, string.Format($"requests.{requestMethod}('{fullUrl}',headers = headers,cookies = jar,data=data)", requestMethod, fullUrl));
            return(sb.ToString().TrimEnd());
        }
Ejemplo n.º 21
0
 private static void NoTouchActionStylesheet_BeforeRequest(Fiddler.Session oSession)
 {
     if (!Models.Settings.Current.DisableBrowserTouchAction)
     {
         return;
     }
     if (oSession.fullUrl != uri)
     {
         return;
     }
     oSession.bBufferResponse = true;
 }
        public string GetResponseFile(Fiddler.Session session)
        {
            var     reqKey = session.RequestMethod + session.fullUrl;
            ReqInfo reqInfo;

            if (_hookUrls.TryGetValue(reqKey, out reqInfo))
            {
                return(reqInfo.ResponseFilePath);
            }

            return(null);
        }
Ejemplo n.º 23
0
        public void Do(Fiddler.Session oSession)
        {
            var header = Packet.GetFirePhpHeader(oSession.ResponseHeaders).ToArray();

            if (header.Any())                //存在需要处理的头
            {
                foreach (var item in header) //移除
                {
                    oSession.ResponseHeaders.Remove(item);
                }
            }
        }
Ejemplo n.º 24
0
        /// <summary>
        /// リクエスト前に処理する
        /// </summary>
        /// <param name="oSession">セッション情報</param>
        public static void BeforeRequest(Fiddler.Session oSession)
        {
            // ★キャストエラーのチェックテスト
            //object obj = (Int32)32;
            //float f = (float)obj;

            // モンラインのみを対象にする
            if (!oSession.hostname.StartsWith("monmusugame"))
            {
                oSession.Ignore();
                return;
            }
        }
Ejemplo n.º 25
0
 private void FiddlerApplication_BeforeRequest(Fiddler.Session oSession)
 {
     oSession.bBufferResponse = false;
     if (HostList.Contains(oSession.host))
     {
         oSession["X-OverrideGateway"] = "localhost:" + MFGPort;
     }
     else
     {
         oSession["X-OverrideGateway"] = "localhost:" + UpstreamPort;
     }
     System.Diagnostics.Debug.WriteLine(oSession.host);
 }
Ejemplo n.º 26
0
        private static void QualityScript_BeforeResponse(Fiddler.Session oSession)
        {
            if (!oSession.url.Contains("osapi.dmm.com/gadgets/ifr?"))
            {
                return;
            }

            var q = Models.Settings.Current.FlashQuality;
            var m = Models.Settings.Current.FlashRenderMode;

            oSession.utilDecodeResponse();
            oSession.utilReplaceInResponse("</head>", string.Format(Properties.Settings.Default.TagQualityShim, q, m) + "</head>");
        }
Ejemplo n.º 27
0
 public void ReplaceUrl2(Fiddler.Session oS)
 {
     foreach (赛尔号登录器.Widget.代理器.MyINI j in myINI)
     {
         if (j.value2.IndexOf("工具") != -1)//判断是不是本地的资源
         {
             if (j.value3 == "真" && oS.uriContains(j.value1))
             {
                 oS.LoadResponseFromFile(path3 + j.value2);
             }
         }
     }
 }
Ejemplo n.º 28
0
 static Fiddler.Session CreateFiddlerSessionFromRequestString(string RequestString)
 {
     string[] RequestParts = RequestString.Split(new string[] { "\r\n\r\n" }, 2, StringSplitOptions.RemoveEmptyEntries);
     Fiddler.HTTPRequestHeaders RequestHeaders = new Fiddler.HTTPRequestHeaders();
     RequestHeaders.AssignFromString(RequestParts[0] + "\r\n\r\n");
     byte[] RequestBody = new byte[] { };
     if (RequestParts.Length > 1)
     {
         RequestBody = Encoding.GetEncoding("ISO-8859-1").GetBytes(RequestParts[1]);
     }
     Fiddler.Session Sess = new Fiddler.Session(RequestHeaders, RequestBody);
     return(Sess);
 }
Ejemplo n.º 29
0
 private static void NoTouchActionStylesheet_BeforeResponse(Fiddler.Session oSession)
 {
     if (!Models.Settings.Current.DisableBrowserTouchAction)
     {
         return;
     }
     if (oSession.fullUrl != uri)
     {
         return;
     }
     oSession.utilDecodeResponse();
     oSession.utilReplaceInResponse("</head>", Properties.Settings.Default.TagNoTouchAction + "</head>");
 }
Ejemplo n.º 30
0
 public void ReplaceUrl(Fiddler.Session oS)
 {
     foreach (赛尔号登录器.Widget.代理器.MyINI j in myINI)
     {
         if (j.value2.IndexOf("工具") == -1)//判断是不是本地的资源
         {
             if (j.value3 == "真" && oS.uriContains(j.value1))
             {
                 oS.url = j.value2;
             }
         }
     }
 }
Ejemplo n.º 31
0
 internal Response(Fiddler.Session Sess)
 {
     this.headers = new ResponseHeaderParameters(this);
     try
     {
         this.ID = Int32.Parse(Sess.oFlags["IronFlag-ID"]);
     }
     catch
     {
         this.ID = 0;
     }
     if (Sess.oFlags.ContainsKey("IronFlag-TTL"))
     {
         this.TTL = Int32.Parse(Sess.oFlags["IronFlag-TTL"]);
     }
     if (Sess.oFlags.ContainsKey("IronFlag-SslError"))
     {
         this.isSSlValid = false;
     }
     if (Sess.oFlags.ContainsKey("IronFlag-BuiltBy"))
     {
         this.Source = Sess.oFlags["IronFlag-BuiltBy"];
     }
     this.httpVersion = Sess.oResponse.headers.HTTPVersion;
     this.code        = Sess.oResponse.headers.HTTPResponseCode;
     try
     {
         if (Sess.oResponse.headers.HTTPResponseStatus.IndexOf(' ') > -1)
         {
             this.status = Sess.oResponse.headers.HTTPResponseStatus.Substring(Sess.oResponse.headers.HTTPResponseStatus.IndexOf(' ')).Trim();
         }
         else
         {
             this.status = "";
         }
     }
     catch (Exception Exp)
     {
         Tools.Trace("Response.cs", "Invalid Fiddler Session Response Status - " + Sess.oResponse.headers.HTTPResponseStatus);
         throw (Exp);
     }
     Fiddler.HTTPResponseHeaders ResHeaders = new Fiddler.HTTPResponseHeaders();
     foreach (Fiddler.HTTPHeaderItem HHI in Sess.oResponse.headers)
     {
         this.Headers.Add(HHI.Name, HHI.Value);
     }
     if (Sess.responseBodyBytes.Length > 0)
     {
         this.SetBody(Sess.responseBodyBytes);
     }
 }
Ejemplo n.º 32
0
 private void FiddlerApplication_BeforeResponse(Fiddler.Session oSession)
 {
     ObserverResult(p =>
     {
         try
         {
             return(p.OnBeforeResponse(oSession));
         }
         catch (Exception oe)
         {
             Logger.Add(3, string.Format("插件 {0}({1}) 执行 OnBeforeResponse 时出错!", p.MenuTitle, p.Version));
             ErrorReporter.SendErrorReport(oe, p.MenuTitle);
             return(false);
         }
     });
 }
Ejemplo n.º 33
0
 public Session(Request Req)
 {
     this.FiddlerSession = Req.ReturnAsFiddlerSession();
     this.Request = Req;
 }
Ejemplo n.º 34
0
 public Session(string RequestString)
 {
     this.FiddlerSession = Session.CreateFiddlerSessionFromRequestString(RequestString);
     this.Request = new Request(this.FiddlerSession);
 }
Ejemplo n.º 35
0
 public Session(Request Request, Response Response)
 {
     this.Request = Request;
     this.Response = Response;
     this.FiddlerSession = new Fiddler.Session(this.Request.GetFullRequestAsByteArray(), this.Response.GetFullResponseAsByteArray());
 }
Ejemplo n.º 36
0
 public Session(string RequestString, string ResponseString)
 {
     this.Request = new Request(RequestString,false,true);
     this.Response = new Response(ResponseString);
     this.FiddlerSession = new Fiddler.Session(this.Request.GetFullRequestAsByteArray(), this.Response.GetFullResponseAsByteArray());
 }
 public FiddlerSessionHolder(Fiddler.Session session, bool isAjaxCall)
 {
     this.session = session;
     this.isAjaxCall = isAjaxCall;
 }
Ejemplo n.º 38
0
 static Fiddler.Session CreateFiddlerSessionFromRequestString(string RequestString)
 {
     string[] RequestParts = RequestString.Split(new string[] { "\r\n\r\n" }, 2, StringSplitOptions.RemoveEmptyEntries);
     Fiddler.HTTPRequestHeaders RequestHeaders = new Fiddler.HTTPRequestHeaders();
     RequestHeaders.AssignFromString(RequestParts[0] + "\r\n\r\n");
     byte[] RequestBody = new byte[] { };
     if (RequestParts.Length > 1)
     {
         RequestBody = Encoding.GetEncoding("ISO-8859-1").GetBytes(RequestParts[1]);
     }
     Fiddler.Session Sess = new Fiddler.Session(RequestHeaders, RequestBody);
     return Sess;
 }
Ejemplo n.º 39
0
 internal Fiddler.Session ReturnAsFiddlerSession()
 {
     Fiddler.HTTPRequestHeaders HRH = this.GetFiddlerHTTPRequestHeaders();
     Fiddler.Session Sess = new Fiddler.Session(HRH, this.bodyArray);
     return Sess;
 }