Exemple #1
0
        public void SetResponse(Response Res, Request Req)
        {
            if (this.BaseTabs.InvokeRequired)
            {
                SetResponse_d InvokeDelegate_d = new SetResponse_d(SetResponse);
                this.BaseTabs.Invoke(InvokeDelegate_d, new object[] { Res, Req });
            }
            else
            {
                this.ClearData();

                this.SetHeader(Res);
                this.SetBody(Res);
                this.SetRoundTrip(Res.RoundTrip);
                FormatPluginsGrid.Rows.Clear();
                foreach (string Name in FormatPlugin.List())
                {
                    FormatPluginsGrid.Rows.Add(new object[] { false, Name });
                }
                this.ResetAllChangedValueStatus();
                this.DisplayedResponse          = Res;
                this.RequestOfDisplayedResponse = Req;
                this.AutoDetectFormatAndSetBodyParameters(Res);
                CheckAndShowReflection();
            }
        }
Exemple #2
0
        public void SetRequest(Request Req)
        {
            if (this.BaseTabs.InvokeRequired)
            {
                SetRequest_d InvokeDelegate_d = new SetRequest_d(SetRequest);
                this.BaseTabs.Invoke(InvokeDelegate_d, new object[] { Req });
            }
            else
            {
                this.ClearData();

                this.SetHeader(Req);
                this.SetBody(Req);
                this.SetUrlPathPartsParameters(Req);
                this.SetQueryParameters(Req);

                this.SetCookieParameters(Req);
                this.SetHeadersParameters(Req);

                FormatPluginsGrid.Rows.Clear();
                FormatPluginsGrid.Rows.Add(new object[] { false, "   --   " });
                foreach (string Name in FormatPlugin.List())
                {
                    FormatPluginsGrid.Rows.Add(new object[] { false, Name });
                }
                //this.SetBodyParameters(Req);
                this.AutoDetectFormatAndSetBodyParameters(Req);
                this.ResetAllChangedValueStatus();
                this.DisplayedRequest = Req;
            }
        }
Exemple #3
0
        private void ScanSelectedWizard_Load(object sender, EventArgs e)
        {
            foreach (string Name in ActivePlugin.List())
            {
                ScanPluginsGrid.Rows.Add(new object[] { true, Name });
            }
            foreach (string Name in FormatPlugin.List())
            {
                FormatGrid.Rows.Add(new object[] { true, Name });
            }
            ScanBranchSessionPluginsCombo.Items.AddRange(SessionPlugin.List().ToArray());

            if (InjectQueryCB.Checked)
            {
                QueryParametersFilterCB.Enabled = true;
            }
            if (InjectBodyCB.Checked)
            {
                BodyParametersFilterCB.Enabled = true;
            }
            if (InjectCookieCB.Checked)
            {
                CookieParametersFilterCB.Enabled = true;
            }
            if (InjectHeadersCB.Checked)
            {
                HeadersParametersFilterCB.Enabled = true;
            }
        }
Exemple #4
0
 private void RequestView_Load(object sender, EventArgs e)
 {
     FormatPluginsGrid.Rows.Clear();
     FormatPluginsGrid.Rows.Add(new object[] { false, "   --   " });
     foreach (string Name in FormatPlugin.List())
     {
         FormatPluginsGrid.Rows.Add(new object[] { false, Name });
     }
     HideBodyFormatOptions();
 }
Exemple #5
0
 private void ResponseView_Load(object sender, EventArgs e)
 {
     FormatPluginsGrid.Rows.Clear();
     foreach (string Name in FormatPlugin.List())
     {
         FormatPluginsGrid.Rows.Add(new object[] { false, Name });
     }
     if (!HasReflectionTab)
     {
         BaseTabs.TabPages.RemoveByKey("ReflectionsTab");
     }
 }
Exemple #6
0
        private void ResponseView_Load(object sender, EventArgs e)
        {
            FormatPluginsGrid.Rows.Clear();
            foreach (string Name in FormatPlugin.List())
            {
                FormatPluginsGrid.Rows.Add(new object[] { false, Name });
            }
            if (!HasReflectionTab)
            {
                BaseTabs.TabPages.RemoveByKey("ReflectionsTab");
            }
            ToolTip Tips = new ToolTip();

            Tips.SetToolTip(RenderLbl, "Render using IE's rendering engine");
            Tips.SetToolTip(ScreenshotBtn, "Screenshot mode");
        }
Exemple #7
0
        internal static void LoadNewFormatPlugins(ScriptEngine Engine)
        {
            string FormatPluginPath = Path.Combine(Config.RootDir, "plugins\\format");

            string[]      FormatPluginFiles = Directory.GetFiles(FormatPluginPath);
            List <string> OldPluginFiles    = new List <string>();
            List <string> NewPluginFiles    = new List <string>();

            foreach (string Name in FormatPlugin.List())
            {
                OldPluginFiles.Add((Config.RootDir + "\\plugins\\format\\" + FormatPlugin.Get(Name).FileName).Replace("/", "\\"));
            }
            foreach (string PluginFile in FormatPluginFiles)
            {
                if (!OldPluginFiles.Contains(PluginFile))
                {
                    NewPluginFiles.Add(PluginFile);
                }
            }
            LoadFormatPlugins(Engine, NewPluginFiles);
        }
Exemple #8
0
        static void GetNewPlugins(XmlNode ManifestNode)
        {
            string PluginType = ManifestNode.Name;

            List <string[]> AllPluginInfo = new List <string[]>();

            switch (PluginType)
            {
            case ("active"):
                foreach (string Name in ActivePlugin.List())
                {
                    ActivePlugin P = ActivePlugin.Get(Name);
                    AllPluginInfo.Add(new string[] { P.FileName, P.Version });
                }
                break;

            case ("passive"):
                foreach (string Name in PassivePlugin.List())
                {
                    PassivePlugin P = PassivePlugin.Get(Name);
                    AllPluginInfo.Add(new string[] { P.FileName, P.Version });
                }
                break;

            case ("format"):
                foreach (string Name in FormatPlugin.List())
                {
                    FormatPlugin P = FormatPlugin.Get(Name);
                    AllPluginInfo.Add(new string[] { P.FileName, P.Version });
                }
                break;

            case ("session"):
                foreach (string Name in SessionPlugin.List())
                {
                    SessionPlugin P = SessionPlugin.Get(Name);
                    AllPluginInfo.Add(new string[] { P.FileName, P.Version });
                }
                break;
            }

            StringBuilder SB = new StringBuilder();
            XmlWriter     XW = XmlWriter.Create(SB);

            XW.WriteStartDocument();
            XW.WriteStartElement("manifest");

            foreach (XmlNode FileNode in ManifestNode.ChildNodes)
            {
                string          Version          = "";
                string          Action           = "";
                string          FileName         = "";
                string          DownloadFileName = "";
                string          Comment          = "";
                List <string[]> SupportFiles     = new List <string[]>();

                foreach (XmlNode PropertyNode in FileNode.ChildNodes)
                {
                    switch (PropertyNode.Name)
                    {
                    case ("version"):
                        Version = PropertyNode.InnerText;
                        break;

                    case ("action"):
                        Action = PropertyNode.InnerText;
                        break;

                    case ("filename"):
                        FileName = PropertyNode.InnerText;
                        break;

                    case ("downloadname"):
                        DownloadFileName = PropertyNode.InnerText;
                        break;

                    case ("comment"):
                        Comment = PropertyNode.InnerText;
                        break;

                    case ("support_file"):
                        string SupportFileName         = "";
                        string SupportFileDownloadName = "";
                        foreach (XmlNode SupportFileNode in PropertyNode.ChildNodes)
                        {
                            switch (SupportFileNode.Name)
                            {
                            case ("filename"):
                                SupportFileName = SupportFileNode.InnerText;
                                break;

                            case ("downloadname"):
                                SupportFileDownloadName = SupportFileNode.InnerText;
                                break;
                            }
                        }
                        SupportFiles.Add(new string[] { SupportFileName, SupportFileDownloadName });
                        break;
                    }
                }

                if (Action.Equals("add") || Action.Equals("update"))
                {
                    bool     MatchFound        = false;
                    string[] MatchedPluginInfo = new string[2];
                    foreach (string[] PluginInfo in AllPluginInfo)
                    {
                        if (PluginInfo[0].Equals(FileName))
                        {
                            MatchFound        = true;
                            MatchedPluginInfo = PluginInfo;
                            break;
                        }
                    }

                    if ((MatchFound && !MatchedPluginInfo[1].Equals(Version)) || !MatchFound)
                    {
                        DownloadPlugin(PluginType, FileName, DownloadFileName);
                        XW.WriteStartElement("file");
                        XW.WriteStartElement("action"); XW.WriteValue(Action); XW.WriteEndElement();
                        XW.WriteStartElement("filename"); XW.WriteValue(FileName); XW.WriteEndElement();
                        XW.WriteStartElement("comment"); XW.WriteValue(Comment); XW.WriteEndElement();
                        XW.WriteEndElement();
                        foreach (string[] SupportFile in SupportFiles)
                        {
                            DownloadPlugin(PluginType, SupportFile[0], SupportFile[1]);
                            XW.WriteStartElement("file");
                            XW.WriteStartElement("action"); XW.WriteValue(Action); XW.WriteEndElement();
                            XW.WriteStartElement("filename"); XW.WriteValue(SupportFile[0]); XW.WriteEndElement();
                            XW.WriteStartElement("comment"); XW.WriteValue(Comment); XW.WriteEndElement();
                            XW.WriteEndElement();
                        }
                    }
                }
            }

            XW.WriteEndElement();
            XW.WriteEndDocument();
            XW.Close();

            StreamWriter SW = File.CreateText(Config.Path + "\\updates\\" + PluginType + "_plugin_manifest.xml");

            SW.Write(SB.ToString());
            SW.Close();
        }
Exemple #9
0
        static void GetNewPlugins()
        {
            string[] PluginManifestLines = PluginManifestFile.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string Line in PluginManifestLines)
            {
                string[] LineParts = Line.Split(new char[] { '|' }, 6);
                if (LineParts.Length != 6)
                {
                    throw new Exception("Invalid 'Plugin Manifest File' recieved from server");
                }
                PluginManifestInfo.Add(LineParts);
            }
            List <string[]> CurrentPluginInfo = new List <string[]>();

            foreach (string Name in ActivePlugin.List())
            {
                ActivePlugin AP          = ActivePlugin.Get(Name);
                string[]     CurrentInfo = new string[] { "active", AP.Version, AP.FileName.Substring(AP.FileName.LastIndexOf('\\') + 1) };
                CurrentPluginInfo.Add(CurrentInfo);
            }
            foreach (string Name in PassivePlugin.List())
            {
                PassivePlugin PP          = PassivePlugin.Get(Name);
                string[]      CurrentInfo = new string[] { "passive", PP.Version, PP.FileName.Substring(PP.FileName.LastIndexOf('\\') + 1) };
                CurrentPluginInfo.Add(CurrentInfo);
            }
            foreach (string Name in FormatPlugin.List())
            {
                FormatPlugin FP          = FormatPlugin.Get(Name);
                string[]     CurrentInfo = new string[] { "format", FP.Version, FP.FileName.Substring(FP.FileName.LastIndexOf('\\') + 1) };
                CurrentPluginInfo.Add(CurrentInfo);
            }
            foreach (string Name in SessionPlugin.List())
            {
                SessionPlugin SP          = SessionPlugin.Get(Name);
                string[]      CurrentInfo = new string[] { "session", SP.Version, SP.FileName.Substring(SP.FileName.LastIndexOf('\\') + 1) };
                CurrentPluginInfo.Add(CurrentInfo);
            }
            foreach (string[] PluginManifestInfoLine in PluginManifestInfo)
            {
                if (PluginManifestInfoLine[0].StartsWith("+") || PluginManifestInfoLine[0].StartsWith("*"))
                {
                    bool MatchFound = false;
                    foreach (string[] CurrentPluginLineInfo in CurrentPluginInfo)
                    {
                        if (PluginManifestInfoLine[1].Equals(CurrentPluginLineInfo[0]) && PluginManifestInfoLine[3].Equals(CurrentPluginLineInfo[2]))
                        {
                            MatchFound = true;
                            if (!PluginManifestInfoLine[2].Equals(CurrentPluginLineInfo[1]))
                            {
                                DownloadPlugin(PluginManifestInfoLine[1], PluginManifestInfoLine[3], PluginManifestInfoLine[4]);
                            }
                            break;
                        }
                        else if (PluginManifestInfoLine[0].Contains("_"))
                        {
                            string[] SupportDetailParts = PluginManifestInfoLine[0].Split(new char[] { '_' }, 2);
                            if (PluginManifestInfoLine[1].Equals(CurrentPluginLineInfo[0]) && SupportDetailParts[1].Equals(CurrentPluginLineInfo[2]))
                            {
                                MatchFound = true;
                                if (!PluginManifestInfoLine[2].Equals(CurrentPluginLineInfo[1]))
                                {
                                    DownloadPlugin(PluginManifestInfoLine[1], PluginManifestInfoLine[3], PluginManifestInfoLine[4]);
                                }
                                break;
                            }
                        }
                    }
                    if (!MatchFound)
                    {
                        DownloadPlugin(PluginManifestInfoLine[1], PluginManifestInfoLine[3], PluginManifestInfoLine[4]);
                    }
                }
            }
        }