本文整理汇总了C#中Fiddler.Session.uriContains方法的典型用法代码示例。如果您正苦于以下问题:C# Session.uriContains方法的具体用法?C# Session.uriContains怎么用?C# Session.uriContains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fiddler.Session
的用法示例。
在下文中一共展示了Session.uriContains方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AutoTamperResponseAfter
public void AutoTamperResponseAfter(Session session)
{
if (!Enabled) return;
if (!session.oRequest.host.Contains("duolingo.com")) return;
if (!session.oResponse.MIMEType.StartsWith("application/j")) return;
if (session.uriContains("/sessions/")) GetAnswersFromResponse(session);
if (session.uriContains("/hints/")) GetHintsFromResponse(session);
}
示例2: RunCheck
public PassiveCheckResult RunCheck(Session fiddlerSession)
{
if (!fiddlerSession.isHTTPS)
{
if (fiddlerSession.uriContains("login"))
{
return PassiveCheckResult.CreateFailure(this, fiddlerSession.url);
}
}
return PassiveCheckResult.CreatePass(this, fiddlerSession.url);
}
示例3: AutoTamperResponseBefore
public void AutoTamperResponseBefore(Session oSession)
{
if (oSession.uriContains("luoqi/fun/option.php"))
{
string xx = oSession.url;
string[] requestPar = xx.Split(new char[2] {'?','&'});
foreach (string i in requestPar)
{
if(i.ToString().Contains("guid="))
{
guid = i.ToString().Substring(i.ToString().IndexOf("=") + 1);
}
}
oSession.utilSetResponseBody("irv=200|sign=" + this.Sign(oSession, prize.Text, guid) + "|couponw=asdafas" + "|prize=" + prize.Text);
}
}
示例4: AutoTamperResponseBefore
public void AutoTamperResponseBefore(Session oSession)
{
if (bAutotestEnabled && oSession.responseCode == 200)
{
foreach (ProductInXML product in products.Values)
{
foreach (ApiItem item in product.apiItems)
{
if (oSession.uriContains(item.url) && oSession.RequestMethod.Equals(item.request.type.ToString()))
{
try
{
String orgResponseBody = Encoding.UTF8.GetString(oSession.responseBodyBytes);
item.response.rootParam.matchWithJsonEntry(JsonEntry.analyzeFromJsonToken(JToken.Parse(orgResponseBody)));
if (item.response.rootParam.matchStruct.matchResult == MatchResult.TYPE_NOT_MATCH)
{
oSession["ui-backcolor"] = "red";
}
log("\n****" + item.url + "****\n" + Utils.insertSpaces(item.response.rootParam.outputMatchResult()));
}
catch (Exception e)
{
}
}
}
}
}
}
示例5: AutoTamperRequestBefore
/// <summary>
/// This function kills known matches early
/// </summary>
/// <param name="oSession"></param>
public void AutoTamperRequestBefore(Session oSession)
{
// Return immediately if no rule is enabled
if (!bBlockerEnabled) return;
string oHost = oSession.host.ToLower();
if ((oHost.StartsWith("ad.") ||
oHost.StartsWith("ads.") ||
slBlockedHosts.Contains(oHost))) { // Consider tailmatch?
if (miHideBlockedSessions.Checked) {
oSession["ui-hide"] = "userblocked";
}
else
{
oSession["ui-strikeout"] = "userblocked";
}
oSession["x-replywithfile"] = "1pxtrans.dat";
return;
}
if (miLikelyPaths.Checked)
{
if (oSession.uriContains("/ad/") || oSession.uriContains("/ads/") || oSession.uriContains("/advert"))
{
if (!oSession.uriContains(sSecret))
{
oSession.oRequest.FailSession(404, "Fiddler - ContentBlock", "Blocked <a href='//"+oSession.url+"?&"+sSecret+"'>Click to see</a>");
oSession.state = SessionStates.Done;
return;
}
}
}
// If Always Removing, do it and return immediately
if (miFlashAlwaysBlock.Checked)
{
if (/*oSession.url.EndsWith(".swf") ||*/ oSession.oRequest.headers.Exists("x-flash-version"))
{
oSession.oRequest.FailSession(404, "Fiddler - ContentBlock", "Blocked Flash");
oSession.state = SessionStates.Done;
return;
}
}
else if (miBlockXDomainFlash.Checked)
{
// Issue: We don't want to block a .SWF's x-domain request for data, but we do want to block the .SWF if it's xDomain. Hrm.
if (oSession.uriContains(".swf"))// || oSession.oRequest.headers.Exists("x-flash-version"))
{
bool bBlock = false;
string sReferer = oSession.oRequest["Referer"];
// Allow if referer was not sent. Note, this is a hole.
if (sReferer == String.Empty) return;
// Block if Referer was from another domain
if (!bBlock)
{
Uri sFromURI;
Uri sToURI;
if ((Uri.TryCreate(sReferer, UriKind.Absolute, out sFromURI)) && (Uri.TryCreate("http://" + oSession.url, UriKind.Absolute, out sToURI)))
{
bBlock = (0 != Uri.Compare(sFromURI, sToURI, UriComponents.Host, UriFormat.Unescaped, StringComparison.InvariantCultureIgnoreCase));
}
}
if (bBlock)
{
oSession.oRequest.FailSession(404, "Fiddler - ContentBlock", "Blocked Flash");
oSession.state = SessionStates.Done;
}
return;
}
}
}
示例6: AutoTamperResponseBefore
public void AutoTamperResponseBefore(Session oSession)
{
if (bAutotestEnabled && apiItems != null && oSession.responseCode == 200)
{
//foreach (MockResponseRules singleRule in rules.Values)
//{
// if (oSession.uriContains(singleRule.ApiPattern))
// {
// String orgResponseBody = Encoding.UTF8.GetString(oSession.responseBodyBytes);
// oSession.responseBodyBytes = Encoding.UTF8.GetBytes(singleRule.MockedResponse(orgResponseBody));
// }
//}
foreach (XMLApiItem item in apiItems.Values)
{
if (oSession.uriContains(item.Apiurl) && item.Response.Type == ResponseType.JSON || item.Response.Type == ResponseType.JSON_LIST)
{
String orgResponseBody = Encoding.UTF8.GetString(oSession.responseBodyBytes);
JToken jtResponse = JToken.Parse(orgResponseBody);
Dictionary<String, JsonResponseEntry> responseJsonEntry = JsonUtil.analyzeResponseEntry(jtResponse);
JsonXMLMatcher matcher = JsonUtil.matchJsonWithXML(responseJsonEntry, item.Response.Items, item.Response.Type == ResponseType.JSON_LIST);
item.Response.matchResult = matcher.matchResult;
if (matcher.matchResult == JsonXMLMatcher.MatchResult.MATCH)
{
logger.Log(item.Apiurl + " match result: MATCHED");
}
else
{
if (matcher.matchResult == JsonXMLMatcher.MatchResult.NOT_MATCH)
{
oSession["ui-backcolor"] = "red";
}
logger.Log(item.Apiurl + " match result:" + matcher.matchResultToString() + "\nroot->\n " +
matcher.ToString().Replace("\n", "\n "));
}
String newResponseBody = JsonUtil.assembleJson(responseJsonEntry).ToString();
String str = Regex.Replace(newResponseBody.Replace(@"\\", @"\"), @"\s *", "").Replace(",\"", ", \"").Replace("\":", "\": ");
oSession.responseBodyBytes = Encoding.Default.GetBytes(str);
logger.Log("RessembleJson:\n" + str + "\n");
}
}
}
}
示例7: AutoTamperRequestBefore
public void AutoTamperRequestBefore(Session oSession)
{
if (bAutotestEnabled)
{
if (oSession.uriContains(strModifyResponseAPI))
{
MockResponseRules rule = APIRequestAnalyzer.analyzeConsoleAPI(Encoding.UTF8.GetString(oSession.RequestBody), logger);
oSession.state = SessionStates.Done;
oSession["ui-hide"] = "true";
if (rule != null)
{
rules.Add(rule.RuleName, rule);
}
}
}
}
示例8: Evaluate
internal void Evaluate(Session session)
{
if (m_isEnabled)
{
using (m_lock.ReadLock())
{
m_segmentMatchers
.Where(x => session.uriContains(x.Key))
.ForEach(x => x.Value.AddMatch(
new Match(){
Url = session.url,
Data =session.requestBodyBytes
},
LowWaterMark, HighWaterMark
));
}
}
}