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


C# Request.Send方法代码示例

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


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

示例1: DownloadIronWASPFile

 static void DownloadIronWASPFile(string FileName, string PseudoName)
 {
     Request IronWASPFileFetchReq = new Request(IronWASPDownloadBaseUrl + PseudoName);
     IronWASPFileFetchReq.Source = RequestSource.Stealth;
     Response IronWASPFileFetchRes = IronWASPFileFetchReq.Send();
     if (!IronWASPFileFetchRes.IsSslValid)
     {
         throw new Exception("Invalid SSL Certificate provided by the server");
     }
     if (IronWASPFileFetchRes.Code != 200)
     {
         throw new Exception("Downloading updated IronWASP version failed");
     }
     if (FileName.Equals("Updater.exe"))
     {
         try
         {
             File.Delete(Config.Path + "\\Updater.exe");
         }
         catch { }
         IronWASPFileFetchRes.SaveBody(Config.Path + "\\Updater.exe");
     }
     else
     {
         IronWASPFileFetchRes.SaveBody(Config.Path + "\\updates\\ironwasp\\" + FileName);
     }
     NewUpdateAvailable = true;
 }
开发者ID:herotheo,项目名称:IronWASP,代码行数:28,代码来源:CheckUpdate.cs

示例2: Inject

 public Response Inject(Request RequestToInject)
 {
     RequestToInject.Source = RequestSource.Scan;
     RequestToInject.ScanID = this.ScanID;
     Response ResponseFromInjection = RequestToInject.Send();
     return SessionHandler.GetInterestingResponse(RequestToInject, ResponseFromInjection);
 }
开发者ID:welias,项目名称:IronWASP,代码行数:7,代码来源:Scanner.cs

示例3: SendRequest

 Response SendRequest(Request Req)
 {
     if(SessionHandler != null && SessionHandler.Name.Length > 0)
         Req = SessionHandler.DoBeforeSending(Req, null);
     Req.SetSource(TesterLogSourceAttributeValue);
     return Req.Send();
 }
开发者ID:herotheo,项目名称:IronWASP,代码行数:7,代码来源:LogsTester.cs

示例4: 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

示例5: StartCheck

        static void StartCheck()
        {
            try
            {
                Request IronWASPManifestReq = new Request(IronWASPManifestUrl);
                IronWASPManifestReq.Source = RequestSource.Stealth;
                IronWASPManifestReq.Headers.Set("User-Agent", "IronWASP v" + CurrentVersion);
                Response IronWASPManifestRes = IronWASPManifestReq.Send();
                if (!IronWASPManifestRes.IsSslValid)
                {
                    throw new Exception("Invalid SSL Certificate provided by the server");
                }
                IronWASPManifestFile = IronWASPManifestRes.BodyString;

                Request ModulesDbReq = new Request(ModulesDbUrl);
                ModulesDbReq.Source = RequestSource.Stealth;
                ModulesDbReq.Headers.Set("User-Agent", "IronWASP v" + CurrentVersion);
                Response ModulesDbRes = ModulesDbReq.Send();
                if (!ModulesDbRes.IsSslValid)
                {
                    throw new Exception("Invalid SSL Certificate provided by the server");
                }
                //The ASCII conversion and substring is done to remove the unicode characters introduced at the beginning of the xml. Must find out why this happens.
                ModulesDbFile = Encoding.ASCII.GetString(ModulesDbRes.BodyArray);
                ModulesDbFile = ModulesDbFile.Substring(ModulesDbFile.IndexOf('<'));

                Request PluginManifestReq = new Request(PluginManifestUrl);
                PluginManifestReq.Source = RequestSource.Stealth;
                PluginManifestReq.Headers.Set("User-Agent","IronWASP v" + CurrentVersion);
                Response PluginManifestRes = PluginManifestReq.Send();
                if (!PluginManifestRes.IsSslValid)
                {
                    throw new Exception("Invalid SSL Certificate provided by the server");
                }
                PluginManifestFile = PluginManifestRes.BodyString;

                Request ModuleManifestReq = new Request(ModuleManifestUrl);
                ModuleManifestReq.Source = RequestSource.Stealth;
                ModuleManifestReq.Headers.Set("User-Agent", "IronWASP v" + CurrentVersion);
                Response ModuleManifestRes = ModuleManifestReq.Send();
                if (!ModuleManifestRes.IsSslValid)
                {
                    throw new Exception("Invalid SSL Certificate provided by the server");
                }
                ModuleManifestFile = ModuleManifestRes.BodyString;

                SetUpUpdateDirs();
                GetNewIronWASP();
                GetNewModulesDb();
                GetNewPlugins();
                GetNewModules();
                if (NewUpdateAvailable)
                {
                    try
                    {
                        Tools.Run(string.Format("{0}\\Updater.exe", Config.RootDir));
                    }
                    catch (Exception Exp) { IronException.Report("Unable to Open IronWASP Updater", Exp); }
                }
            }
            catch(ThreadAbortException) { }
            catch(Exception Exp)
            {
                IronException.Report("Software Update Failed", Exp);
            }
        }
开发者ID:herotheo,项目名称:IronWASP,代码行数:66,代码来源:CheckUpdate.cs

示例6: DownloadPlugin

 static void DownloadPlugin(string PluginType, string FileName, string PseudoName)
 {
     Request PluginFetchReq = new Request(PluginDownloadBaseUrl + PluginType + "/" + PseudoName);
     PluginFetchReq.Source = RequestSource.Stealth;
     Response PluginFetchRes = PluginFetchReq.Send();
     if (!PluginFetchRes.IsSslValid)
     {
         throw new Exception("Invalid SSL Certificate provided by the server");
     }
     if (PluginFetchRes.Code != 200)
     {
         throw new Exception("Downloading updated plugins failed");
     }
     try
     {
         PluginFetchRes.SaveBody(Config.Path + "\\updates\\plugins\\" + PluginType + "\\" + FileName);
         NewUpdateAvailable = true;
     }
     catch (Exception Exp) { IronException.Report(string.Format("Error Downloading Plugin: {0} - {1} - {2}", PluginType, FileName, PseudoName), Exp); }
 }
开发者ID:herotheo,项目名称:IronWASP,代码行数:20,代码来源:CheckUpdate.cs

示例7: DownloadModule

 static void DownloadModule(string ModuleName, string PseudoName)
 {
     Request ModuleFetchReq = new Request(ModuleDownloadBaseUrl + "/" + PseudoName);
     ModuleFetchReq.Source = RequestSource.Stealth;
     Response ModuleFetchRes = ModuleFetchReq.Send();
     if (!ModuleFetchRes.IsSslValid)
     {
         throw new Exception("Invalid SSL Certificate provided by the server");
     }
     if (ModuleFetchRes.Code != 200)
     {
         throw new Exception("Downloading updated modules failed");
     }
     try
     {
         ModuleFetchRes.SaveBody(Config.Path + "\\updates\\modules\\" + ModuleName + ".zip");
         using (ZipFile ZF = ZipFile.Read(Config.Path + "\\updates\\modules\\" + ModuleName + ".zip"))
         {
             ZF.ExtractAll(Config.Path + "\\updates\\modules\\");
         }
         NewUpdateAvailable = true;
     }
     catch (Exception Exp) { IronException.Report(string.Format("Error Downloading Module: {0} - {1} ", ModuleName, PseudoName), Exp); }
 }
开发者ID:herotheo,项目名称:IronWASP,代码行数:24,代码来源:CheckUpdate.cs

示例8: StartCheck

        static void StartCheck()
        {
            try
            {
                Request PluginManifestReq = new Request(PluginManifestUrl);
                PluginManifestReq.Source = RequestSource.Stealth;
                PluginManifestReq.Headers.Set("User-Agent","IronWASP v" + CurrentVersion);
                Response PluginManifestRes = PluginManifestReq.Send();
                if (!PluginManifestRes.IsSslValid)
                {
                    throw new Exception("Invalid SSL Certificate provided by the server");
                }
                PluginManifestFile = PluginManifestRes.BodyString;

                Request IronWASPManifestReq = new Request(IronWASPManifestUrl);
                IronWASPManifestReq.Source = RequestSource.Stealth;
                IronWASPManifestReq.Headers.Set("User-Agent", "IronWASP v" + CurrentVersion);
                Response IronWASPManifestRes = IronWASPManifestReq.Send();
                if (!IronWASPManifestRes.IsSslValid)
                {
                    throw new Exception("Invalid SSL Certificate provided by the server");
                }
                IronWASPManifestFile = IronWASPManifestRes.BodyString;

                SetUpUpdateDirs();
                GetNewPlugins();
                GetNewIronWASP();
                if (NewUpdateAvailable)
                {
                    try
                    {
                        Tools.Run(Config.RootDir + "/" + "Updater.exe");
                    }
                    catch (Exception Exp) { IronException.Report("Unable to Open IronWASP Updater", Exp); }
                }
            }
            catch(ThreadAbortException) { }
            catch(Exception Exp)
            {
                IronException.Report("Software Update Failed", Exp);
            }
        }
开发者ID:moon2l,项目名称:IronWASP,代码行数:42,代码来源:CheckUpdate.cs


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