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); }
/// <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)); }
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(""); } }
public static Session CreateSessionFromRequestString(string RequestString) { Fiddler.Session Sess = Session.CreateFiddlerSessionFromRequestString(RequestString); Session IrSe = new Session(Sess); return(IrSe); }
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); }
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); } }
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の品質設定を行いました。"); } } }
public HttpRequestLine(Fiddler.Session sess) { Method = sess.RequestMethod; ProtocolVersion = sess.RequestHeaders.HTTPVersion; URI = sess.fullUrl; RequestLine = string.Format("{0} {1} {2}", Method, URI, ProtocolVersion); }
private static void OverrideStylesheet_BeforeRequest(Fiddler.Session oSession) { if (oSession.fullUrl != Properties.Settings.Default.KanColleGamePage.AbsoluteUri) { return; } oSession.bBufferResponse = true; }
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; }
public Session(Fiddler.Session _FiddlerSession) { this.FiddlerSession = _FiddlerSession; this.Request = new Request(this.FiddlerSession); if (this.FiddlerSession.bHasResponse) { this.Response = new Response(this.FiddlerSession); } }
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>"); }
public Session(Fiddler.Session _FiddlerSession) { this.FiddlerSession = _FiddlerSession; this.Request = new Request(this.FiddlerSession); try { this.Response = new Response(this.FiddlerSession); } catch { } }
/// <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"); }
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()); }
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); }
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); } } }
/// <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; } }
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); }
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>"); }
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); } } } }
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); }
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>"); }
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; } } } }
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); } }
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); } }); }
public Session(Request Req) { this.FiddlerSession = Req.ReturnAsFiddlerSession(); this.Request = Req; }
public Session(string RequestString) { this.FiddlerSession = Session.CreateFiddlerSessionFromRequestString(RequestString); this.Request = new Request(this.FiddlerSession); }
public Session(Request Request, Response Response) { this.Request = Request; this.Response = Response; this.FiddlerSession = new Fiddler.Session(this.Request.GetFullRequestAsByteArray(), this.Response.GetFullResponseAsByteArray()); }
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; }
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; }
internal Fiddler.Session ReturnAsFiddlerSession() { Fiddler.HTTPRequestHeaders HRH = this.GetFiddlerHTTPRequestHeaders(); Fiddler.Session Sess = new Fiddler.Session(HRH, this.bodyArray); return Sess; }