本文整理汇总了C#中Fiddler.Session.GetResponseBodyAsString方法的典型用法代码示例。如果您正苦于以下问题:C# Session.GetResponseBodyAsString方法的具体用法?C# Session.GetResponseBodyAsString怎么用?C# Session.GetResponseBodyAsString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fiddler.Session
的用法示例。
在下文中一共展示了Session.GetResponseBodyAsString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AutoTamperResponseBefore
public void AutoTamperResponseBefore(Session oSession)
{
DelayedResponsesInformation delayData = null;
//
// when fiddler initialized
// sometimes an exception is thrown
//
try
{
delayData = fiddlerHook.GetDelayFor(
oSession.url,
oSession.GetResponseBodyAsString()
);
}
catch (Exception) { }
if (delayData != null)
{
try
{
Thread.Sleep(delayData.DelaySec * 1000);
}
catch (Exception) { }
}
}
示例2: FiddlerApplication_BeforeResponse
static void FiddlerApplication_BeforeResponse(Session oSession)
{
string url = oSession.url;
DateTime start = oSession.Timers.ClientBeginRequest;
DateTime end = oSession.Timers.ClientDoneResponse;
TimeSpan t = end - start;
if (oSession.host != filter)
return;
if(oSession.Timers.DNSTime > 0)
Console.WriteLine("DNS TIME: {0}", oSession.Timers.DNSTime);
if (!sdata.Keys.Contains(url))
sdata[url] = new List<RequestAggregate>();
RequestAggregate rq = new RequestAggregate()
{
data_size = oSession.GetResponseBodyAsString().Length,
host = oSession.host,
time = t.TotalMilliseconds
};
Monitor.Enter(sdata[url]);
sdata[url].Add(rq);
Monitor.Exit(sdata[url]);
ConsoleColor c = Console.ForegroundColor;
Console.ForegroundColor = ConsoleColor.DarkRed;
Console.WriteLine("{0} ==> {1}", oSession.url, end-start);
Console.ForegroundColor = defaultColor;
}
示例3: Handle
public override void Handle(Session Session)
{
string ResponseJson = Session.GetResponseBodyAsString();
EventListDungeons result = JsonConvert.DeserializeObject<EventListDungeons>(ResponseJson);
lock (FFRKProxy.Instance.Cache.SyncRoot)
{
foreach (DataDungeon dungeon in result.Dungeons)
{
DataCache.Dungeons.Key key = new DataCache.Dungeons.Key { DungeonId = dungeon.Id };
DataCache.Dungeons.Data data = null;
if (!FFRKProxy.Instance.Cache.Dungeons.TryGetValue(key, out data))
{
data = new DataCache.Dungeons.Data
{
Difficulty = dungeon.Difficulty,
Name = dungeon.Name,
Series = dungeon.SeriesId,
Type = dungeon.Type,
WorldId = dungeon.WorldId
};
FFRKProxy.Instance.Cache.Dungeons.Update(key, data);
}
}
}
FFRKProxy.Instance.Database.BeginExecuteRequest(new DbOpRecordDungeonList(result));
FFRKProxy.Instance.RaiseListDungeons(result);
}
示例4: Handle
public override void Handle(Session Session)
{
string ResponseJson = Session.GetResponseBodyAsString();
EventBattleInitiated result = JsonConvert.DeserializeObject<EventBattleInitiated>(ResponseJson);
FFRKProxy.Instance.GameState.ActiveBattle = result;
FFRKProxy.Instance.RaiseBattleInitiated(result);
}
示例5: GetResponseBody
public override string GetResponseBody(Session Session)
{
string ResponseBody = Session.GetResponseBodyAsString();
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(ResponseBody);
HtmlNode node = doc.DocumentNode.SelectSingleNode(".//script[@data-app-init-data]");
if (node == null)
return null;
return node.InnerHtml;
}
示例6: FiddlerApplication_BeforeResponse
private void FiddlerApplication_BeforeResponse(Session oSession)
{
if (!set.CacheEnabled) return;
if (oSession.PathAndQuery.StartsWith("/kcsapi/api_start2") && Settings.Current.HackEnabled)
{
jsonData = oSession.GetResponseBodyAsString();
ModifyData.Items.ForEach(x => setModifiedData(x));
oSession.utilSetResponseBody(jsonData);
}
}
示例7: smethod_2
private static void smethod_2(Session session_0)
{
if (Class1.string_8 == "")
{
if (session_0.fullUrl.Contains("habbo") && session_0.fullUrl.EndsWith("/client") && !session_0.fullUrl.Contains("facebook") && session_0.GetResponseBodyAsString().Contains("sso.ticket"))
{
session_0.SaveRequest(Environment.CurrentDirectory + "\\http-headers.txt", true);
Class6.smethod_1();
Class6.smethod_0(session_0.GetResponseBodyAsString());
Class0.main_0.method_22();
}
}
else
{
if (session_0.fullUrl == Class1.string_8 && session_0.GetResponseBodyAsString().Contains("sso.ticket"))
{
session_0.SaveRequest(Environment.CurrentDirectory + "\\http-headers.txt", true);
Class6.smethod_1();
Class6.smethod_0(session_0.GetResponseBodyAsString());
Class0.main_0.method_22();
}
}
}
示例8: FiddlerApplicationOnBeforeResponse
public void FiddlerApplicationOnBeforeResponse(Session oSession)
{
if (oSession.RequestMethod != "GET")
return;
var oBody = oSession.GetResponseBodyAsString();
var responseLower = oBody.ToLower();
var clientScore = _clientDetectors.Count(clientDetector => responseLower.Contains(clientDetector));
if (clientScore < (_clientDetectors.Length/2)) return;
var clientParser = new ClientParser(_manager, oSession.GetResponseBodyAsString());
if (clientParser.Parse())
{
oSession.utilDecodeResponse();
SetStatus($"Found server details. {clientParser.IpAddress}:{clientParser.Port}", Color.Green);
if(!_manager.ManualHotel)
_manager.StartServer(clientParser.IpAddress, clientParser.Port);
else
_manager.StartServer(IPAddress.Parse(""), 30000);
oBody = oBody.Replace(clientParser.OFlashVars["connection.info.host"], $"\"{(clientParser.Base64Host ? StringToBase64(_manager.ServerIpAddress.ToString()) : _manager.ServerIpAddress.ToString())}\"");
oBody = oBody.Replace(clientParser.OFlashVars["connection.info.port"], $"\"{(clientParser.Base64Port ? StringToBase64(_manager.ServerPort.ToString()) : _manager.ServerPort.ToString())}\"");
oBody = oBody.Replace(clientParser.OFlashVars["client.starting"], "\"RetroImpact has been injected, loading hotel..\"");
oBody = Regex.Replace(oBody, "<audio id=\"player\" src=\"(.*?)\" autoplay=\"true\"></audio>", ""); // Get rid of a stupid radio #np
oSession.utilSetResponseBody(oBody);
_manager.StopIntercept();
}
else
SetStatus(clientParser.ErrorMessage, Color.Red);
}
示例9: getBodyInfo
private static Hashtable getBodyInfo(Session oS, bool bUseV1dot2Format)
{
int num;
int num2;
Hashtable hashtable = new Hashtable();
getDecompressedSize(oS, out num, out num2);
hashtable.Add("size", num);
hashtable.Add("compression", num2);
hashtable.Add("mimeType", oS.oResponse["Content-Type"]);
if (oS.responseBodyBytes != null)
{
string mIMEType = oS.oResponse.MIMEType;
bool flag = IsMIMETypeTextEquivalent(mIMEType);
if (((flag && ("text/plain" == mIMEType)) && (oS.responseBodyBytes.Length > 3)) && ((((oS.responseBodyBytes[0] == 0x43) && (oS.responseBodyBytes[1] == 0x57)) && (oS.responseBodyBytes[2] == 0x53)) || (((oS.responseBodyBytes[0] == 70) && (oS.responseBodyBytes[1] == 0x4c)) && (oS.responseBodyBytes[2] == 0x56))))
{
flag = false;
}
if (flag)
{
if (oS.responseBodyBytes.Length < _iMaxTextBodyLength)
{
hashtable.Add("text", oS.GetResponseBodyAsString());
return hashtable;
}
hashtable.Add("comment", "Body length exceeded fiddler.importexport.HTTPArchiveJSON.MaxTextBodyLength, so body was omitted.");
return hashtable;
}
if (bUseV1dot2Format)
{
if (oS.responseBodyBytes.Length < _iMaxBinaryBodyLength)
{
hashtable.Add("encoding", "base64");
hashtable.Add("text", Convert.ToBase64String(oS.responseBodyBytes));
return hashtable;
}
hashtable.Add("comment", "Body length exceeded fiddler.importexport.HTTPArchiveJSON.MaxBinaryBodyLength, so body was omitted.");
}
}
return hashtable;
}
示例10: Handle
public override void Handle(Session Session)
{
string ResponseJson = Session.GetResponseBodyAsString();
EventListBattles result = JsonConvert.DeserializeObject<EventListBattles>(ResponseJson);
FFRKProxy.Instance.GameState.ActiveDungeon = result;
lock (FFRKProxy.Instance.Cache.SyncRoot)
{
result.Battles.Sort((x,y) => x.Id.CompareTo(y.Id));
ushort stam_to_reach = 0;
for (int i=0; i < result.Battles.Count; ++i)
{
DataBattle battle = result.Battles[i];
DataCache.Battles.Key key = new DataCache.Battles.Key { BattleId = battle.Id };
DataCache.Battles.Data data = null;
if (!FFRKProxy.Instance.Cache.Battles.TryGetValue(key, out data))
{
data = new DataCache.Battles.Data
{
DungeonId = battle.DungeonId,
HistoSamples = 1,
Name = battle.Name,
Repeatable = (i < result.Battles.Count-1),
Samples = 1,
Stamina = battle.Stamina,
StaminaToReach = stam_to_reach
};
FFRKProxy.Instance.Cache.Battles.Update(key, data);
}
stam_to_reach += battle.Stamina;
}
}
FFRKProxy.Instance.Database.BeginExecuteRequest(new DbOpRecordBattleList(result));
FFRKProxy.Instance.RaiseListBattles(result);
}
示例11: ReportAsync
private static async void ReportAsync(Session oSession)
{
if (!Config.Current.ReportToKancolleDB) return;
foreach (var api in apinames)
if (oSession.PathAndQuery.Contains(api))
{
try
{
var request = HttpUtility.HtmlDecode(oSession.GetRequestBodyAsString());
request = regextoken.Replace(request, "");
var response = oSession.GetResponseBodyAsString().Replace("svdata=", "");
var wrq = WebRequest.CreateHttp("http://api.kancolle-db.net/2/");
wrq.Method = "POST";
wrq.ContentType = "application/x-www-form-urlencoded";
var data = "token=" + HttpUtility.UrlEncode(Config.Current.KancolleDBToken)
+ "&agent=LZXNXVGPejgSnEXLH2ur"//伪装为KCV
+ "&url=" + HttpUtility.UrlEncode(oSession.fullUrl)
+ "&requestbody=" + HttpUtility.UrlEncode(request)
+ "&responsebody=" + HttpUtility.UrlEncode(response);
wrq.ContentLength = Encoding.UTF8.GetByteCount(data);
using (var sw = new StreamWriter(await wrq.GetRequestStreamAsync()))
{
sw.Write(data);
sw.Flush();
}
using (var wrs = wrq.GetResponse() as HttpWebResponse)
{
System.Diagnostics.Debug.WriteLine(wrs.StatusCode);
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex);
}
}
}
示例12: FiddlerApplication_BeforeResponse
static void FiddlerApplication_BeforeResponse(Session rpSession)
{
var rSession = rpSession.Tag as NetworkSession;
if (rSession != null)
{
if (rSession.State == NetworkSessionState.Requested)
rSession.State = NetworkSessionState.Responsed;
var rApiSession = rSession as ApiSession;
if (rApiSession != null)
{
rApiSession.ResponseBodyString = rpSession.GetResponseBodyAsString();
ApiParserManager.Instance.Process(rApiSession);
}
var rResourceSession = rSession as ResourceSession;
if (rResourceSession != null)
CacheService.Instance.ProcessResponse(rResourceSession, rpSession);
if (rpSession.PathAndQuery == "/gadget/js/kcs_flash.js")
{
var rScript = rpSession.GetResponseBodyAsString();
var rModified = false;
var rQuality = Preference.Current.Browser.Flash.Quality;
if (rQuality != FlashQuality.Default)
{
rScript = r_FlashQualityRegex.Replace(rScript, $"$1{rQuality}$2");
rModified = true;
}
var rRenderMode = Preference.Current.Browser.Flash.RenderMode;
if (rRenderMode != FlashRenderMode.Default)
{
rScript = r_FlashRenderModeRegex.Replace(rScript, $"$1{rRenderMode}$2");
rModified = true;
}
if (rModified)
rpSession.utilSetResponseBody(rScript);
}
if (rSession.FullUrl == GameConstants.GamePageUrl)
{
ForceOverrideStylesheet(rpSession);
var rSource = rpSession.GetResponseBodyAsString();
rSource = r_SuppressReloadConfirmation.Replace(rSource, "false");
rpSession.utilSetResponseBody(rSource);
}
if (rpSession.oResponse.headers.Any(rHeader => rHeader.Name == "Content-Range"))
System.Diagnostics.Debugger.Break();
}
}
示例13: FiddlerApplication_BeforeResponse
void FiddlerApplication_BeforeResponse(FiddlerSession rpSession)
{
var rSession = rpSession.Tag as Session;
if (rSession != null)
{
if (rSession.Status == SessionStatus.Request)
rSession.Status = SessionStatus.Responsed;
var rApiSession = rSession as ApiSession;
if (rApiSession != null)
{
rApiSession.ResponseString = rpSession.GetResponseBodyAsString();
ApiParsers.Post(rApiSession);
}
var rResourceSession = rSession as ResourceSession;
if (rResourceSession != null && ResourceCache.IsEnabled && rpSession.responseCode == 200 && !File.Exists(rResourceSession.CachePath) && rpSession.oResponse["Last-Modified"] != null)
{
rResourceSession.Data = rpSession.ResponseBody;
rResourceSession.LastModifiedTime = Convert.ToDateTime(rpSession.oResponse["Last-Modified"]);
ResourceCache.SaveFile(rResourceSession);
}
if (rSession.Url.Contains("kcs/sound/titlecall/") || rSession.Url.Contains("api_start2"))
KanColleGame.Current.RaiseGameLaunchedEvent();
}
Debug.WriteLine("Response - " + rpSession.fullUrl);
}
示例14: FiddlerApplication_BeforeReturningError
void FiddlerApplication_BeforeReturningError(FiddlerSession rpSession)
{
var rSession = rpSession.Tag as Session;
if (rSession != null)
{
rSession.Message = rpSession.GetResponseBodyAsString();
rSession.Status = SessionStatus.Error;
}
}
示例15: GetBodyInfo
private static Content GetBodyInfo(Session oS)
{
var content = new Content();
int num;
int num2;
GetDecompressedSize(oS, out num, out num2);
content.size = num;
content.compression = num2;
content.mimeType = oS.oResponse["Content-Type"];
string mImeType = oS.oResponse.MIMEType;
bool isMimeTypeTextEquivalent = Utility.IsMimeTypeTextEquivalent(mImeType);
if (((isMimeTypeTextEquivalent && ("text/plain" == mImeType)) && (oS.responseBodyBytes.Length > 3)) &&
((((oS.responseBodyBytes[0] == 0x43) && (oS.responseBodyBytes[1] == 0x57)) &&
(oS.responseBodyBytes[2] == 0x53)) ||
(((oS.responseBodyBytes[0] == 70) && (oS.responseBodyBytes[1] == 0x4c)) &&
(oS.responseBodyBytes[2] == 0x56))))
{
isMimeTypeTextEquivalent = false;
}
if (isMimeTypeTextEquivalent)
{
content.text = oS.GetResponseBodyAsString();
return content;
}
if (oS.responseBodyBytes.Length < MaxBinaryBodyLength)
{
content.encoding = "base64";
content.text = Convert.ToBase64String(oS.responseBodyBytes);
return content;
}
content.comment =
"Body length exceeded Mocument.Transcoders.HttpArchiveTranscoder.MaxBinaryBodyLength , so body was omitted.";
return content;
}