当前位置: 首页>>代码示例>>C#>>正文


C# Request.GetClone方法代码示例

本文整理汇总了C#中IronWASP.Request.GetClone方法的典型用法代码示例。如果您正苦于以下问题:C# Request.GetClone方法的具体用法?C# Request.GetClone怎么用?C# Request.GetClone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IronWASP.Request的用法示例。


在下文中一共展示了Request.GetClone方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Trigger

 public Trigger(string RequestTrigger, Request Req, string ResponseTrigger, Response Res)
 {
     this.RequestTrigger = RequestTrigger;
     this.Request = Req.GetClone();
     this.ResponseTrigger = ResponseTrigger;
     this.Response = Res.GetClone();
 }
开发者ID:welias,项目名称:IronWASP,代码行数:7,代码来源:Trigger.cs

示例2: AddProbeString

 public static void AddProbeString(string ProbeString, Request InjectedRequest)
 {
     Request ClonedReq = InjectedRequest.GetClone();
     lock (ProbeStrings)
     {
         ProbeStrings.Add(ProbeString, ClonedReq);
     }
 }
开发者ID:moon2l,项目名称:IronWASP,代码行数:8,代码来源:Analyzer.cs

示例3: Trigger

 public Trigger(string RequestTrigger, string RequestTriggerDescription, Request Req, string ResponseTrigger, string ResponseTriggerDescription, Response Res)
 {
     this.RequestTrigger = RequestTrigger;
     this.RequestTriggerDescription = RequestTriggerDescription;
     this.Request = Req.GetClone();
     this.ResponseTrigger = ResponseTrigger;
     this.RawResponseTriggerDescription = ResponseTriggerDescription;
     this.Response = Res.GetClone();
 }
开发者ID:0ks3ii,项目名称:IronWASP,代码行数:9,代码来源:Trigger.cs

示例4: InjectInRequest

 public Request InjectInRequest(Request Req, int InjectionPoint, string Payload)
 {
     string CurrentRequestHash = Tools.MD5(Req.ToString());
     string XML = "";
     if(this.RequestHash.Equals(CurrentRequestHash))
     {
         XML = this.RequestXml;
     }
     else
     {
         XML = this.ToXmlFromRequest(Req);
         this.RequestXml = XML;
         this.RequestHash = CurrentRequestHash;
     }
     string InjectedXml = InjectInXml(this.RequestXml, InjectionPoint, Payload);
     return this.ToRequestFromXml(Req.GetClone(true), InjectedXml);
 }
开发者ID:kartikeyap,项目名称:IronWASP,代码行数:17,代码来源:FormatPlugin.cs

示例5: GetTestRequest

 Request GetTestRequest(Request Req)
 {
     Request TestRequest = Req.GetClone();
     switch (TestType)
     {
         case(AddParameterTest):
             return AddParameter(TestRequest);
         case(EditParameterTest):
             return EditParameter(TestRequest);
         case(DeleteParameterTest):
             return DeleteParameter(TestRequest);
     }
     return TestRequest;
 }
开发者ID:herotheo,项目名称:IronWASP,代码行数:14,代码来源:LogsTester.cs

示例6: NormalizeUrl

        string NormalizeUrl(Request Req, string RawLink)
        {
            if (RawLink.IndexOf('#') > -1)
            {
                RawLink = RawLink.Substring(0, RawLink.IndexOf('#'));
            }
            if (RawLink.StartsWith("http://") || RawLink.StartsWith("https://"))
            {
                return RawLink;
            }
            else if (RawLink.StartsWith("//"))
            {
                if (Req.SSL)
                    RawLink = "https:" + RawLink;
                else
                    RawLink = "http:" + RawLink;
            }
            else if (RawLink.StartsWith("/"))
            {
                Request TempReq = Req.GetClone();
                TempReq.Url = RawLink;
                return TempReq.FullUrl;
            }
            else if (RawLink.StartsWith("javascript:") || RawLink.StartsWith("file:"))
            {
                //ignore
            }
            else
            {
                List<string> UrlPathParts = Req.UrlPathParts;
                if (UrlPathParts.Count > 0)
                {
                    if (!Req.Url.EndsWith("/")) UrlPathParts.RemoveAt(UrlPathParts.Count - 1);
                }

                if (RawLink.StartsWith("../"))
                {
                    string[] RawUrlParts = RawLink.Split(new char[] { '/' });
                    List<string> TreatedRawUrlParts = new List<string>(RawUrlParts);
                    foreach (string Part in RawUrlParts)
                    {
                        if (Part.Equals("..") && (UrlPathParts.Count > 0))
                        {
                            UrlPathParts.RemoveAt(UrlPathParts.Count - 1);
                            TreatedRawUrlParts.RemoveAt(0);
                        }
                        else
                        {
                            break;
                        }
                    }
                    StringBuilder TreatedRawUrlBuilder = new StringBuilder("/");
                    foreach (string RawPart in TreatedRawUrlParts)
                    {
                        TreatedRawUrlBuilder.Append(RawPart);
                    }
                    string TreatedRawUrl = TreatedRawUrlBuilder.ToString();
                    if (!RawLink.EndsWith("/"))
                    {
                        TreatedRawUrl = TreatedRawUrl.TrimEnd(new char[] { '/' });
                    }
                    Request TempReq = Req.GetClone();
                    Request NormaliserRequest = new Request(TempReq.FullUrl);
                    NormaliserRequest.Url = "/";
                    NormaliserRequest.UrlPathParts = UrlPathParts;
                    TempReq.Url = NormaliserRequest.Url;
                    TempReq.Url = TempReq.Url.TrimEnd(new char[] { '/' }) + TreatedRawUrl;
                    return TempReq.FullUrl;
                }
                else if (RawLink.Length > 0)
                {
                    Request TempReq = Req.GetClone();
                    Request NormaliserRequest = new Request(TempReq.FullUrl);
                    NormaliserRequest.Url = "/";
                    NormaliserRequest.UrlPathParts = UrlPathParts;
                    TempReq.Url = NormaliserRequest.Url;

                    if (TempReq.Url.EndsWith("/"))
                    {
                        TempReq.Url = TempReq.Url + RawLink;
                    }
                    else
                    {
                        TempReq.Url = TempReq.Url + "/" + RawLink;
                    }
                    return TempReq.FullURL;
                }
            }
            return "";
        }
开发者ID:msaindane,项目名称:IronWASP,代码行数:90,代码来源:Crawler.cs

示例7: IsA404

 bool IsA404(Request Req, Response Res)
 {
     Response NotFoundResponse;
     if (NotFoundSignatures.ContainsKey(Req.SSL.ToString() + Req.Host + Req.File))
         NotFoundResponse = NotFoundSignatures[Req.SSL.ToString() + Req.Host + Req.File];
     else
     {
         Request NotFoundGetter = Req.GetClone();
         NotFoundGetter.Method = "GET";
         NotFoundGetter.Body.RemoveAll();
         if(Req.File.Length > 0)
             NotFoundGetter.Url = NotFoundGetter.UrlDir + "should_not_xist_" + Tools.GetRandomString(10,15) + "." + Req.File;
         else
             NotFoundGetter.Url = NotFoundGetter.UrlDir + "should_not_xist_" + Tools.GetRandomString(10, 15);
         NotFoundResponse = NotFoundGetter.Send();
         NotFoundResponse.Flags.Add("Url", NotFoundGetter.Url);
         lock (NotFoundSignatures)
         {
             if (!NotFoundSignatures.ContainsKey(Req.SSL.ToString() + Req.Host + Req.File))
                 NotFoundSignatures.Add(Req.SSL.ToString() + Req.Host + Req.File, NotFoundResponse);
         }
     }
     if(Res.Code == 200 && NotFoundResponse.Code != 200) return false;
     if(Res.Code == 404) return true;
     if(Res.Code == 403)
     {
         if(NotFoundResponse.Code == 403)
             return true;
         else
             return false;
     }
     if (Res.Code > 400)
     {
         if (NotFoundResponse.Code == Res.Code)
             return true;
         else
             return false;
     }
     string NotFoundGetterUrl = NotFoundResponse.Flags["Url"].ToString();
     if (Res.Code == 301 || Res.Code == 302 || Res.Code == 303 || Res.Code == 307)
     {
         string RedirectedUrl = Res.Headers.Get("Location");
         if (NotFoundResponse.Code == 301 || NotFoundResponse.Code == 302 || NotFoundResponse.Code == 303 || NotFoundResponse.Code == 307)
         {
             string NotFoundRedirectedUrl = NotFoundResponse.Headers.Get("Location");
             if (RedirectedUrl.ToLower().Equals(NotFoundRedirectedUrl.ToLower()))
                 return true;
             else if (Regex.IsMatch(RedirectedUrl, @".*not\Wfound.*", RegexOptions.IgnoreCase))
                 return true;
             else if (NotFoundRedirectedUrl.Replace(NotFoundGetterUrl,"").Equals(RedirectedUrl.Replace(Req.Url, "")))
                 return true;
             else
             {
                 Request RedirectedLocationReq;
                 if (RedirectedUrl.StartsWith("http://") || RedirectedUrl.StartsWith("https://"))
                 {
                     RedirectedLocationReq = new Request(RedirectedUrl);
                 }
                 else if (RedirectedUrl.StartsWith("/"))
                 {
                     RedirectedLocationReq = Req.GetClone();
                     RedirectedLocationReq.Url = RedirectedUrl;
                 }
                 else
                 {
                     return true;
                 }
                 Request NotFoundRedirectedLocationReq;
                 if (NotFoundRedirectedUrl.StartsWith("http://") || NotFoundRedirectedUrl.StartsWith("https://"))
                 {
                     NotFoundRedirectedLocationReq = new Request(NotFoundRedirectedUrl);
                 }
                 else if (NotFoundRedirectedUrl.StartsWith("/"))
                 {
                     NotFoundRedirectedLocationReq = Req.GetClone();
                     NotFoundRedirectedLocationReq.Url = NotFoundRedirectedUrl;
                 }
                 else
                 {
                     return false;
                 }
                 if (RedirectedLocationReq.Url.Equals(NotFoundRedirectedLocationReq.Url)) return true;
             }
         }
         else
             return false;
     }
     return false;
 }
开发者ID:msaindane,项目名称:IronWASP,代码行数:89,代码来源:Crawler.cs

示例8: Crawl

        void Crawl(Request Req, int Depth, bool Scraped)
        {
            if (Stopped) return;
            if (Depth > MaxDepth) return;
            if (WasCrawled(Req)) return;
            if (!CanCrawl(Req)) return;

            lock (PageSignatures)
            {
                PageSignatures.Add(GetPageSignature(Req));
            }

            Req.Source = RequestSource.Probe;
            Req.SetCookie(Cookies);
            if (UserAgent.Length > 0) Req.Headers.Set("User-Agent", UserAgent);
            Response Res = Req.Send();
            Cookies.Add(Req, Res);
            bool Is404File = IsA404(Req, Res);

            if (!Res.IsHtml)
            {
                try
                {
                    Res.ProcessHtml();
                }
                catch
                {
                    return;
                }
            }

            if (Depth + 1 > MaxDepth) return;
            List<Request> LinkClicks = GetLinkClicks(Req, Res);
            foreach (Request LinkClick in LinkClicks)
            {
                AddToCrawlQueue(LinkClick, Depth + 1, true);
            }

            List<Request> FormSubmissions = GetFormSubmissionRequests(Req, Res);
            foreach (Request FormSubmission in FormSubmissions)
            {
                AddToCrawlQueue(FormSubmission, Depth + 1, true);
            }

            Request DirCheck = Req.GetClone();
            DirCheck.Method = "GET";
            DirCheck.Body.RemoveAll();
            DirCheck.Url = DirCheck.UrlDir;

            if (!Req.Url.EndsWith("/"))
            {
                AddToCrawlQueue(DirCheck, Depth + 1, false);
            }

            if (PerformDirAndFileGuessing && !Is404File)
            {
                foreach (string File in FileNamesToCheck)
                {
                    Request FileCheck = DirCheck.GetClone();
                    FileCheck.Url = FileCheck.Url + File;
                    AddToCrawlQueue(FileCheck, Depth + 1, false);
                }

                foreach (string Dir in DirNamesToCheck)
                {
                    Request DirectoryCheck = DirCheck.GetClone();
                    DirectoryCheck.Url = DirectoryCheck.Url + Dir + "/";
                    AddToCrawlQueue(DirectoryCheck, Depth + 1, false);
                }
            }

            if (Scraped || !Is404File)
            {
                lock (CrawledRequests)
                {
                    CrawledRequests.Enqueue(Req);
                }
                IronUpdater.AddToSiteMap(Req);
            }
        }
开发者ID:msaindane,项目名称:IronWASP,代码行数:80,代码来源:Crawler.cs

示例9: StoreRequest

 public void StoreRequest(Request Request)
 {
     ManualTesting.StoreRequest(Request.GetClone());
 }
开发者ID:moon2l,项目名称:IronWASP,代码行数:4,代码来源:ScriptedSender.cs

示例10: GetFormSubmissions

        public static List<Request> GetFormSubmissions(Request Req, Response Res, CookieStore Cookies)
        {
            List<Request> FormSubmissions = new List<Request>();
            List<HtmlNode> FormNodes = Res.Html.GetForms();
            foreach (HtmlNode FormNode in FormNodes)
            {
                Request SubReq = Req.GetClone();
                SubReq.Method = "GET";
                SubReq.BodyString = "";

                foreach (HtmlAttribute Attr in FormNode.Attributes)
                {
                    if (Attr.Name.Equals("method"))
                    {
                        SubReq.Method = Attr.Value.ToUpper();
                    }
                    else if(Attr.Name.Equals("action"))
                    {
                        if (Attr.Value.StartsWith("javascript:")) continue;
                        string ActionUrl = NormalizeUrl(Req, Tools.HtmlDecode(Attr.Value.Trim()));
                        if (ActionUrl.Length > 0)
                        {
                            SubReq.FullUrl = ActionUrl;
                        }
                    }
                }

                if (SubReq.Method == "GET")
                {
                    SubReq.Query.RemoveAll();
                }
                else
                {
                    SubReq.Headers.Set("Content-Type", "application/x-www-form-urlencoded");
                }

                foreach (HtmlNode InputNode in FormNode.ChildNodes)
                {
                    string Name = "";
                    string Value = "";
                    foreach (HtmlAttribute Attr in InputNode.Attributes)
                    {
                        switch(Attr.Name)
                        {
                            case("name"):
                                Name = Attr.Value;
                                break;
                            case("type"):
                                if(Attr.Value.Equals("submit")) Name = "";
                                break;
                            case("value"):
                                Value = Attr.Value;
                                break;
                        }
                    }
                    if (Value.Length == 0)
                    {
                        Value = Tools.GetRandomString(2,5);
                    }
                    if (Name.Length > 0)
                    {
                        if (SubReq.Method.Equals("GET"))
                            SubReq.Query.Add(Name, Value);
                        else
                            SubReq.Body.Add(Name, Value);
                    }
                }
                SubReq.SetCookie(Cookies);
                FormSubmissions.Add(SubReq);
            }
            return FormSubmissions;
        }
开发者ID:mskr30,项目名称:IronWASP,代码行数:72,代码来源:Crawler.cs

示例11: AddShellRequest

 internal static void AddShellRequest(Request Request)
 {
     if (Request != null)
     {
         try
         {
             Request ClonedRequest = Request.GetClone(true);
             if (ClonedRequest != null)
             {
                 lock (ShellRequestQ)
                 {
                     ShellRequestQ.Enqueue(ClonedRequest);
                 }
             }
             else
             {
                 Tools.Trace("IronUpdater", "Null Shell Request");
             }
         }
         catch (Exception Exp)
         {
             IronException.Report("Error adding Shell Request for updating", Exp.Message, Exp.StackTrace);
         }
     }
 }
开发者ID:moon2l,项目名称:IronWASP,代码行数:25,代码来源:IronUpdater.cs

示例12: IsA404

        bool IsA404(Request Req, Response Res)
        {
            Response NotFoundResponse = null;
            lock (NotFoundSignatures)
            {
                if (NotFoundSignatures.ContainsKey(string.Format("{0}{1}{2}{3}", Req.SSL, Req.Host, Req.UrlDir, Req.File)))
                {
                    NotFoundResponse = NotFoundSignatures[string.Format("{0}{1}{2}{3}", Req.SSL, Req.Host, Req.UrlDir, Req.File)];
                }
            }
            if(NotFoundResponse == null)
            {
                Request NotFoundGetter = Req.GetClone();
                NotFoundGetter.Method = "GET";
                NotFoundGetter.Body.RemoveAll();
                if (Req.File.Length > 0)
                    NotFoundGetter.Url = string.Format("{0}should_not_xist_{1}.{2}", NotFoundGetter.UrlDir, Tools.GetRandomString(10, 15), Req.File);
                else
                    NotFoundGetter.Url = string.Format("{0}should_not_xist_{1}", NotFoundGetter.UrlDir, Tools.GetRandomString(10, 15));
                NotFoundResponse = NotFoundGetter.Send();
                if (Stopped) return true;
                NotFoundResponse.BodyString = "";
                List<string> HeaderNames = NotFoundResponse.Headers.GetNames();
                foreach (string HeaderName in HeaderNames)
                {
                    if (!HeaderName.Equals("Location"))
                    {
                        NotFoundResponse.Headers.Remove(HeaderName);
                    }
                }
                NotFoundResponse.Flags.Add("Url", NotFoundGetter.Url);
                lock (NotFoundSignatures)
                {
                    if (!NotFoundSignatures.ContainsKey(string.Format("{0}{1}{2}{3}", Req.SSL, Req.Host, Req.UrlDir, Req.File)))
                        NotFoundSignatures.Add(string.Format("{0}{1}{2}{3}", Req.SSL, Req.Host, Req.UrlDir, Req.File), NotFoundResponse);
                }
            }
            if(Res.Code == 200 && NotFoundResponse.Code != 200) return false;
            if(Res.Code == 404) return true;

            if (Res.Code > 400)
            {
                if (NotFoundResponse.Code == Res.Code)
                    return true;
                else
                    return false;
            }
            string NotFoundGetterUrl = NotFoundResponse.Flags["Url"].ToString();
            if (Res.Code == 301 || Res.Code == 302 || Res.Code == 303 || Res.Code == 307)
            {
                string RedirectedUrl = Res.Headers.Get("Location");
                if (NotFoundResponse.Code == 301 || NotFoundResponse.Code == 302 || NotFoundResponse.Code == 303 || NotFoundResponse.Code == 307)
                {
                    string NotFoundRedirectedUrl = NotFoundResponse.Headers.Get("Location");
                    if (RedirectedUrl.ToLower().Equals(NotFoundRedirectedUrl.ToLower()))
                        return true;
                    else if (Regex.IsMatch(RedirectedUrl, @".*not\Wfound.*", RegexOptions.IgnoreCase))
                        return true;
                    else if (NotFoundRedirectedUrl.Replace(NotFoundGetterUrl,"").Equals(RedirectedUrl.Replace(Req.Url, "")))
                        return true;
                    else
                    {
                        Request RedirectedLocationReq;
                        if (RedirectedUrl.StartsWith("http://") || RedirectedUrl.StartsWith("https://"))
                        {
                            RedirectedLocationReq = new Request(RedirectedUrl);
                        }
                        else if (RedirectedUrl.StartsWith("/"))
                        {
                            RedirectedLocationReq = Req.GetClone();
                            RedirectedLocationReq.Url = RedirectedUrl;
                        }
                        else
                        {
                            return true;
                        }
                        Request NotFoundRedirectedLocationReq;
                        if (NotFoundRedirectedUrl.StartsWith("http://") || NotFoundRedirectedUrl.StartsWith("https://"))
                        {
                            NotFoundRedirectedLocationReq = new Request(NotFoundRedirectedUrl);
                        }
                        else if (NotFoundRedirectedUrl.StartsWith("/"))
                        {
                            NotFoundRedirectedLocationReq = Req.GetClone();
                            NotFoundRedirectedLocationReq.Url = NotFoundRedirectedUrl;
                        }
                        else
                        {
                            return false;
                        }
                        if (RedirectedLocationReq.Url.Equals(NotFoundRedirectedLocationReq.Url)) return true;
                    }
                }
                else
                    return false;
            }
            return false;
        }
开发者ID:0ks3ii,项目名称:IronWASP,代码行数:98,代码来源:Crawler.cs

示例13: Is

 public virtual bool Is(Request Request)
 {
     try
     {
         Request Req = Request.GetClone();
         string XmlString = ToXmlFromRequest(Req);
         if (!Tools.IsXml(XmlString)) return false;
         Request FinalReq = ToRequestFromXml(Req, XmlString);
         if (Req.ToString().Equals(FinalReq.ToString())) return true;
     }
     catch { return false; }
     return false;
 }
开发者ID:welias,项目名称:IronWASP,代码行数:13,代码来源:FormatPlugin.cs

示例14: Scanner

 public Scanner(Request Request)
 {
     this.OriginalRequest = Request.GetClone();
 }
开发者ID:welias,项目名称:IronWASP,代码行数:4,代码来源:Scanner.cs

示例15: GetFormSubmissionRequests

        List<Request> GetFormSubmissionRequests(Request Req, Response Res)
        {
            List<Request> FormSubmissions = new List<Request>();
            List<HtmlNode> FormNodes = Res.Html.GetForms();
            foreach (HtmlNode FormNode in FormNodes)
            {
                Request SubReq = Req.GetClone();
                SubReq.Method = "GET";
                SubReq.Body.RemoveAll();

                foreach (HtmlAttribute Attr in FormNode.Attributes)
                {
                    if (Attr.Name.Equals("method"))
                    {
                        SubReq.Method = Attr.Value.ToUpper();
                    }

                    if (SubReq.Method.Equals("GET")) SubReq.Query.RemoveAll();

                    if (Attr.Name.Equals("action"))
                    {
                        if (Attr.Value.StartsWith("javascript:")) continue;
                        string ActionUrl = NormalizeUrl(Req, Attr.Value.Trim());
                        if (ActionUrl.Length > 0)
                        {
                            SubReq.FullUrl = ActionUrl;
                        }
                    }
                }
                foreach (HtmlNode InputNode in FormNode.ChildNodes)
                {
                    string Name = "";
                    string Value = "";
                    foreach (HtmlAttribute Attr in InputNode.Attributes)
                    {
                        switch(Attr.Name)
                        {
                            case("name"):
                                Name = Attr.Value;
                                break;
                            case("type"):
                                if(Attr.Value.Equals("submit")) Name = "";
                                break;
                            case("value"):
                                Value = Attr.Value;
                                break;
                        }
                    }
                    if (Value.Length == 0)
                    {
                        Value = Tools.GetRandomString(2,5);
                    }
                    if (Name.Length > 0)
                    {
                        if (SubReq.Method.Equals("GET"))
                            SubReq.Query.Add(Name, Value);
                        else
                            SubReq.Body.Add(Name, Value);
                    }
                }
                FormSubmissions.Add(SubReq);
            }
            return FormSubmissions;
        }
开发者ID:msaindane,项目名称:IronWASP,代码行数:64,代码来源:Crawler.cs


注:本文中的IronWASP.Request.GetClone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。