public PersistentReportResult(ReportResult result)
 {
     this.PersistentNVT = new PersistentReportNVT(result.NVT);
     this.Description = result.Description;
     this.Host = result.Host;
     this.Port = result.Port;
     this.Subnet = result.Subnet;
     this.Threat = result.Threat;
 }
Beispiel #2
0
        public OpenVASScan(XmlNode response)
        {
            OpenVASScan report = this;

            XmlNode nd = (response.FirstChild.FirstChild.ChildNodes.Count == 0) ? response.FirstChild : response.FirstChild.FirstChild;

            foreach (XmlNode node in nd.ChildNodes)
            {
                Console.WriteLine(node.Name);

                if (node.Name == "filters")
                {
                    foreach (XmlNode child in node.ChildNodes)
                    {
                        //ignore filters for now
                    }
                }
                else if (node.Name == "ports")
                {
                    report.Ports = new List <ReportPort>();
                    foreach (XmlNode child in node.ChildNodes)
                    {
                        ReportPort port = new ReportPort();
                        foreach (XmlNode c in child.ChildNodes)
                        {
                            if (c.Name == "host")
                            {
                                port.Host = c.InnerText;
                            }
                            else if (c.Name == "threat")
                            {
                                port.Threat = c.InnerText;
                            }
                            else
                            {
                                port.Description = c.InnerText;
                            }
                        }

                        report.Ports.Add(port);
                    }
                }
                else if (node.Name == "results")
                {
                    report.Results = new List <ReportResult>();
                    foreach (XmlNode child in node.ChildNodes)
                    {
                        ReportResult result = new ReportResult();
                        foreach (XmlNode c in child.ChildNodes)
                        {
                            if (c.Name == "subnet")
                            {
                                result.Subnet = c.InnerText;
                            }
                            else if (c.Name == "host")
                            {
                                result.Host = c.InnerText;
                            }
                            else if (c.Name == "port")
                            {
                                result.Port = c.InnerText;
                            }
                            else if (c.Name == "nvt")
                            {
                                result.NVT = new ReportNVT();

                                result.NVT.OID = c.Attributes["oid"].Value;
                                foreach (XmlNode n in c.ChildNodes)
                                {
                                    if (n.Name == "name")
                                    {
                                        result.NVT.Name = n.InnerText;
                                    }
                                    else if (n.Name == "cvss_base")
                                    {
                                        result.NVT.CVSSBaseValue = n.InnerText;
                                    }
                                    else if (n.Name == "risk_factor")
                                    {
                                        result.NVT.RiskFactor = n.InnerText;
                                    }
                                }
                            }
                            else if (c.Name == "threat")
                            {
                                result.Threat = c.InnerText;
                            }
                            else if (c.Name == "description")
                            {
                                result.Description = c.InnerText;
                            }
                        }

                        report.Results.Add(result);
                    }
                }
            }
        }
Beispiel #3
0
        public OpenVASScan(XmlNode response)
        {
            OpenVASScan report = this;

            XmlNode nd = (response.FirstChild.FirstChild.ChildNodes.Count == 0) ? response.FirstChild : response.FirstChild.FirstChild;

            foreach (XmlNode node in nd.ChildNodes)
            {
                Console.WriteLine(node.Name);

                if (node.Name == "filters")
                {
                    foreach (XmlNode child in node.ChildNodes)
                    {
                        //ignore filters for now
                    }
                }
                else if (node.Name == "ports")
                {
                    report.Ports = new List<ReportPort>();
                    foreach (XmlNode child in node.ChildNodes)
                    {
                        ReportPort port = new ReportPort();
                        foreach (XmlNode c in child.ChildNodes)
                        {
                            if (c.Name == "host")
                                port.Host = c.InnerText;
                            else if (c.Name == "threat")
                                port.Threat = c.InnerText;
                            else
                                port.Description = c.InnerText;

                        }

                        report.Ports.Add(port);
                    }
                }
                else if (node.Name == "results")
                {
                    report.Results = new List<ReportResult>();
                    foreach (XmlNode child in node.ChildNodes)
                    {
                        ReportResult result = new ReportResult();
                        foreach (XmlNode c in child.ChildNodes)
                        {
                            if (c.Name == "subnet")
                                result.Subnet = c.InnerText;
                            else if (c.Name == "host")
                                result.Host = c.InnerText;
                            else if (c.Name == "port")
                                result.Port = c.InnerText;
                            else if (c.Name == "nvt")
                            {
                                result.NVT = new ReportNVT();

                                result.NVT.OID = c.Attributes["oid"].Value;
                                foreach (XmlNode n in c.ChildNodes)
                                {
                                    if (n.Name == "name")
                                        result.NVT.Name = n.InnerText;
                                    else if (n.Name == "cvss_base")
                                        result.NVT.CVSSBaseValue = n.InnerText;
                                    else if (n.Name == "risk_factor")
                                        result.NVT.RiskFactor = n.InnerText;
                                }
                            }
                            else if (c.Name == "threat")
                                result.Threat = c.InnerText;
                            else if (c.Name == "description")
                                result.Description = c.InnerText;
                        }

                        report.Results.Add(result);
                    }
                }
            }
        }