public static void Add(PassivePlugin PP) { if ((PP.Name.Length > 0) && !(PP.Name.Equals("All") || PP.Name.Equals("None"))) { if (!List().Contains(PP.Name)) { PP.FileName = PluginStore.FileName; Collection.Add(PP); } } }
internal static bool ShouldRunResponseBasedPassivePlugins() { if (PassivePlugin.GetInLinePluginsForResponse().Count > 0) { return(true); } else { return(false); } }
public static void Add(PassivePlugin PP) { if ((PP.Name.Length > 0) && !(PP.Name.Equals("All") || PP.Name.Equals("None"))) { if (!List().Contains(PP.Name)) { PP.FileName = PluginEngine.FileName; Collection.Add(PP); } } }
public static PluginResults RunPassivePlugin(PassivePlugin P, Session Irse) { PluginResults Results = new PluginResults(); P.Check(Irse, Results); foreach (PluginResult PR in Results.GetAll()) { PR.Plugin = P.Name; PR.Report(); } return(Results); }
public static Findings RunPassivePlugin(PassivePlugin P, Session Irse) { Findings Results = new Findings(); P.Check(Irse, Results, false); foreach (Finding PR in Results.GetAll()) { PR.Plugin = P.Name; PR.Report(); } return(Results); }
public static PassivePlugin Get(string Name) { foreach (PassivePlugin PP in Collection) { if (PP.Name.Equals(Name)) { PassivePlugin NewInstance = PP.GetInstance(); NewInstance.FileName = PP.FileName; return(NewInstance); } } return(null); }
public static Findings RunPassivePlugin(PassivePlugin P, Session Irse) { Findings Results = new Findings(); P.Check(Irse, Results, false); foreach (Finding F in Results.GetAll()) { F.FinderName = P.Name; F.FinderType = "PassivePlugin"; F.Report(); } return(Results); }
internal static void ReloadPlugin(PluginType Type, string Name, string PluginFileName) { string FileName = ""; switch (Type) { case PluginType.Passive: FileName = Config.RootDir + "\\plugins\\passive\\" + PluginFileName; lock (PassivePlugin.Collection) { PassivePlugin.Remove(Name); LoadPlugin(FileName); } break; case PluginType.Active: FileName = Config.RootDir + "\\plugins\\active\\" + PluginFileName; lock (ActivePlugin.Collection) { ActivePlugin.Remove(Name); LoadPlugin(FileName); } break; case PluginType.Format: FileName = Config.RootDir + "\\plugins\\format\\" + PluginFileName; lock (FormatPlugin.Collection) { FormatPlugin.Remove(Name); LoadPlugin(FileName); IronUI.UpdateAllFormatPluginRows(); } break; case PluginType.Session: FileName = Config.RootDir + "\\plugins\\session\\" + PluginFileName; lock (SessionPlugin.Collection) { SessionPlugin.Remove(Name); LoadPlugin(FileName); } break; } IronUI.UpdateAllFormatPluginRows(); IronUI.UpdateAllActivePluginRows(); IronUI.BuildPluginTree(); }
private void StepOneNextBtn_Click(object sender, EventArgs e) { ShowStep0Error(""); string Name = PluginNameTB.Text.Trim(); if (Name.Length == 0) { PluginNameTB.BackColor = Color.Red; ShowStep0Error("Plugin name cannot be empty"); return; } if (!Regex.IsMatch(Name, "^[a-zA-Z]+$")) { PluginNameTB.BackColor = Color.Red; ShowStep0Error("Plugin Name should only contain alphabets (a-z)"); return; } if (!Name[0].ToString().ToUpper().Equals(Name[0].ToString())) { ShowStep0Error("Plugin Name should begin with an upper case letter"); return; } if (PassivePlugin.List().Contains(Name)) { PluginNameTB.BackColor = Color.Red; ShowStep0Error("A Passive Plugin with this name already exists. Select a different name."); return; } string Desc = PluginDescTB.Text; if (Desc.Trim().Length == 0) { PluginDescTB.BackColor = Color.Red; ShowStep0Error("Plugin description cannot be empty"); return; } this.PluginName = Name; this.PluginDescription = Desc; this.CurrentStep = 1; this.BaseTabs.SelectTab("PluginTypeTab"); }
public static void RunAllResponseBasedOfflinePassivePlugins(Session IrSe) { foreach (string Name in PassivePlugin.List()) { PassivePlugin P = PassivePlugin.Get(Name); if ((P.WorksOn == PluginWorksOn.Response) || (P.WorksOn == PluginWorksOn.Both)) { if (P.CallingState == PluginCallingState.Offline) { try { PluginEngine.RunPassivePlugin(P, IrSe); } catch (Exception Exp) { IronException.Report("Error executing 'Offline' Passive Plugin : " + Name, Exp.Message, Exp.StackTrace); } } } } }
public static void RunAllRequestBasedInlinePassivePlugins(Session IrSe) { foreach (string Name in PassivePlugin.GetInLinePluginsForRequest()) { PassivePlugin P = PassivePlugin.Get(Name); if ((P.WorksOn == PluginWorksOn.Request) || (P.WorksOn == PluginWorksOn.Both)) { if (P.CallingState == PluginCallingState.Inline) { try { PluginEngine.RunPassivePlugin(P, IrSe); } catch (Exception Exp) { IronException.Report("Error executing 'BeforeRequestInterception' Passive Plugin - " + Name, Exp.Message, Exp.StackTrace); } } } } }
internal static void LoadNewPassivePlugins(ScriptEngine Engine) { string PassivePluginPath = Path.Combine(Config.RootDir, "plugins\\passive"); string[] PassivePluginFiles = Directory.GetFiles(PassivePluginPath); List <string> OldPluginFiles = new List <string>(); List <string> NewPluginFiles = new List <string>(); foreach (string Name in PassivePlugin.List()) { OldPluginFiles.Add((Config.RootDir + "\\plugins\\passive\\" + PassivePlugin.Get(Name).FileName).Replace("/", "\\")); } foreach (string PassivePluginFile in PassivePluginFiles) { if (!OldPluginFiles.Contains(PassivePluginFile)) { NewPluginFiles.Add(PassivePluginFile); } } LoadPassivePlugins(Engine, NewPluginFiles); }
public static void RunAllPassivePluginsAfterResponseInterception(Session IrSe) { foreach (string Name in PassivePlugin.List()) { PassivePlugin P = PassivePlugin.Get(Name); if ((P.WorksOn == PluginWorksOn.Response) || (P.WorksOn == PluginWorksOn.Both)) { if ((P.CallingState == PluginCallingState.AfterInterception) || (P.CallingState == PluginCallingState.Both)) { try { PluginStore.RunPassivePlugin(P, IrSe); } catch (Exception Exp) { IronException.Report("Error executing 'AfterResponseInterception' Passive Plugin : " + Name, Exp.Message, Exp.StackTrace); } } } } }
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]); } } } }
public static PluginResults RunPassivePlugin(PassivePlugin P, Session Irse) { PluginResults Results = new PluginResults(); P.Check(Irse, Results); foreach (PluginResult PR in Results.GetAll()) { PR.Plugin = P.Name; IronUpdater.AddPluginResult(PR); } return Results; }
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(); }
public static Findings RunPassivePlugin(PassivePlugin P, Session Irse) { Findings Results = new Findings(); P.Check(Irse, Results, false); foreach (Finding PR in Results.GetAll()) { PR.Plugin = P.Name; PR.Report(); } return Results; }
public static PluginResults RunPassivePlugin(PassivePlugin P, Session Irse) { PluginResults Results = new PluginResults(); P.Check(Irse, Results); foreach (PluginResult PR in Results.GetAll()) { PR.Plugin = P.Name; PR.Report(); } return Results; }
public static Findings RunPassivePlugin(PassivePlugin P, Session Irse) { Findings Results = new Findings(); P.Check(Irse, Results, false); foreach (Finding F in Results.GetAll()) { F.FinderName = P.Name; F.FinderType = "PassivePlugin"; F.Report(); } return Results; }