本文整理汇总了C#中IronWASP.Request.SetSource方法的典型用法代码示例。如果您正苦于以下问题:C# Request.SetSource方法的具体用法?C# Request.SetSource怎么用?C# Request.SetSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IronWASP.Request
的用法示例。
在下文中一共展示了Request.SetSource方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FuzzCreateCodeBtn_Click
private void FuzzCreateCodeBtn_Click(object sender, EventArgs e)
{
ShowFuzzStep3Error("");
string SessionPluginName = "";
if (FuzzUseCustomLogSourceCB.Checked)
{
if (FuzzLogSourceTB.Text.Trim().Length > 0)
{
try
{
Request Req = new Request("http://a.site");
Req.SetSource(FuzzLogSourceTB.Text.Trim());
FuzzLogSourceValue = FuzzLogSourceTB.Text.Trim();
}
catch(Exception Exp)
{
ShowFuzzStep3Error(string.Format("Invalid Log source - {0}", Exp.Message));
return;
}
}
else
{
ShowFuzzStep3Error("Log source cannot be empty. Either uncheck this option or enter a valid log source");
return;
}
}
foreach (DataGridViewRow Row in FuzzSessionPluginGrid.Rows)
{
if ((bool)Row.Cells[0].Value)
{
if (Row.Index == 0)
{
SessionPluginName = "";
}
else
{
SessionPluginName = Row.Cells[1].Value.ToString();
}
break;
}
}
StringBuilder Py = new StringBuilder();
StringBuilder Rb = new StringBuilder();
Py.AppendLine();
Rb.AppendLine();
Py.AppendLine("#'req' is a variable that is assumed to contain a Request object");
Rb.AppendLine("#'req' is a variable that is assumed to contain a Request object");
Py.AppendLine();
Rb.AppendLine();
if (FuzzUseUiRB.Checked)
{
Py.AppendLine("#We display a GUI based wizard to user and get the Fuzzer setting from user.");
Py.AppendLine("f = Fuzzer.FromUi(req)");
Rb.AppendLine("#We display a GUI based wizard to user and get the Fuzzer setting from user.");
Rb.AppendLine("f = Fuzzer.FromUi(req)");
}
else
{
Py.AppendLine("#We create a new Fuzzer to fuzz the request 'req'");
Py.AppendLine("f = Fuzzer(req)");
Rb.AppendLine("#We create a new Fuzzer to fuzz the request 'req'");
Rb.AppendLine("f = Fuzzer.new(req)");
if (FuzzInjectionPoints.ContainsKey("UrlPathParts"))
{
if (FuzzInjectionPoints["UrlPathParts"].Length == 0)
{
Py.AppendLine("#Select all UrlPathparts for injection");
Py.AppendLine("f.InjectUrl()");
Rb.AppendLine("#Select all UrlPathparts for injection");
Rb.AppendLine("f.inject_url");
}
else
{
Py.AppendLine("#Select the UrlPathpart at specified positions for injection");
Rb.AppendLine("#Select the UrlPathpart at specified positions for injection");
foreach (string Position in FuzzInjectionPoints["UrlPathParts"])
{
Py.AppendLine(string.Format("f.InjectUrl({0})", Position.Trim()));
Rb.AppendLine(string.Format("f.inject_url({0})", Position.Trim()));
}
}
}
if (FuzzInjectionPoints.ContainsKey("Query"))
{
if (FuzzInjectionPoints["Query"].Length == 0)
{
Py.AppendLine("#Select all Query parameters for injection");
Py.AppendLine("f.InjectQuery()");
Rb.AppendLine("#Select all Query parameters for injection");
Rb.AppendLine("f.inject_query()");
}
//.........这里部分代码省略.........
示例2: SendRequest
Response SendRequest(Request Req)
{
if(SessionHandler != null && SessionHandler.Name.Length > 0)
Req = SessionHandler.DoBeforeSending(Req, null);
Req.SetSource(TesterLogSourceAttributeValue);
return Req.Send();
}
示例3: SRCreateCodeBtn_Click
private void SRCreateCodeBtn_Click(object sender, EventArgs e)
{
ShowSRError("");
StringBuilder Py = new StringBuilder();
StringBuilder Rb = new StringBuilder();
Py.AppendLine();
Rb.AppendLine();
Py.AppendLine("#'req' is a variable that is assumed to contain a Request object");
Rb.AppendLine("#'req' is a variable that is assumed to contain a Request object");
if (SRSendWithLogSourceRB.Checked)
{
try
{
Request Req = new Request("http://google.com");
Req.SetSource(SRLogSourceTB.Text);
string LogSource = SRLogSourceTB.Text;
Py.AppendLine("#The LogSource is set");
Rb.AppendLine("#The LogSource is set");
Py.AppendLine(string.Format(@"req.SetSource(""{0}"")", LogSource));
Rb.AppendLine(string.Format(@"req.set_source(""{0}"")", LogSource));
}
catch(Exception Exp)
{
ShowSRError(Exp.Message);
}
}
Py.AppendLine("#Request is sent and the response stored in a variable named 'res'");
Rb.AppendLine("#Request is sent and the response stored in a variable named 'res'");
Py.AppendLine("res = req.Send()");
Rb.AppendLine("res = req.send_req");
if (SRFollowRedirectRB.Checked)
{
Py.AppendLine("#Check if the response is a redirect");
Py.AppendLine("if res.IsRedirect:");
Py.Append(" "); Py.AppendLine("#Get the redirect Request and store it in a variable named 'rd_req'. The redirect is followed by sending 'rd_req'");
Py.Append(" "); Py.AppendLine("rd_req = req.GetRedirect(res)");
Py.Append(" "); Py.AppendLine("final_res = rd_req.Send()");
Rb.AppendLine("#Check if the response is a redirect");
Rb.AppendLine("if res.is_redirect");
Rb.Append(" "); Rb.AppendLine("#Get the redirect Request and store it in a variable named 'rd_req'. The redirect is followed by sending 'rd_req'");
Rb.Append(" "); Rb.AppendLine("rd_req = req.get_redirect(res)");
Rb.Append(" "); Rb.AppendLine("final_res = rd_req.send_req");
Rb.AppendLine("end");
}
ShowCode(Py.ToString(), Rb.ToString());
}