public override void ProcessRequest(HttpContext context) { using (OpenVASManagerSession session = new OpenVASManagerSession(ConfigurationManager.AppSettings["openvasUser"], ConfigurationManager.AppSettings["openvasPass"], ConfigurationManager.AppSettings["openvasHost"])) { using (OpenVASManager manager = new OpenVASManager(session)) { XmlDocument doc = manager.GetConfigs(string.Empty, false, false, string.Empty, string.Empty); context.Response.Write(doc.OuterXml); } } }
public static void Main(string[] args) { using (OpenVASSession session = new OpenVASSession ("admin", "password", "192.168.1.99")) { using (OpenVASManager manager = new OpenVASManager (session)) { XDocument target = manager.CreateSimpleTarget ("192.168.1.0/24", Guid.NewGuid ().ToString ()); string targetID = target.Root.Attribute ("id").Value; XDocument configs = manager.GetScanConfigurations (); string discoveryConfigID = string.Empty; foreach (XElement node in configs.Descendants(XName.Get("name"))) { if (node.Value == "Discovery") { discoveryConfigID = node.Parent.Attribute ("id").Value; break; } } XDocument task = manager.CreateSimpleTask (Guid.NewGuid ().ToString (), string.Empty, new Guid (discoveryConfigID), new Guid (targetID)); Guid taskID = new Guid (task.Root.Attribute ("id").Value); manager.StartTask (taskID); XDocument status = manager.GetTasks (taskID); while (status.Descendants ("status").First ().Value != "Done") { Thread.Sleep (500); Console.WriteLine (status.Descendants (XName.Get ("progress")).First ().Nodes ().OfType<XText> ().First ().Value); status = manager.GetTasks (taskID); } XDocument results = manager.GetTaskResults (taskID); Console.WriteLine (results.ToString ()); } } }
public virtual void Create(OpenVASManager manager) { manager.CreateTask(this.Name, this.Comment, this.Config.RemoteConfigID.ToString(), this.Target.RemoteTargetID.ToString(), this.Escalator.RemoteEscalatorID.ToString(), this.Schedule.RemoteScheduleID.ToString(), this.Slave.RemoteSlaveID.ToString()); }