public void AddReport(Nessus.NessusReport nessus) { ReportTemplate report = this; foreach (Objects.Nessus.Host host in nessus.Report.Hosts) { ReportTemplate.Host newHost = new ReportTemplate.Host() { IPAddress = host.Address, ComputerName = host.Properties.NetBiosName, OperatingSystem = host.Properties.OperatingSystem, ExtraInformation = host.Properties.tags.ToDictionary(k => k.Name, k => k.Value) }; foreach (Nessus.ReportItem item in host.Items) { if (item.port == 0) continue; ReportTemplate.Port open = new ReportTemplate.Port() { Number = item.port, Protocol = item.Protocol, Severity = item.Severity, ThreatLevel = item.RiskFactor, Description = item.Description, Tool = "Nessus", }; newHost.OpenPorts.Add(open); } report.Hosts.Add(newHost); } FixAdd(); }
public void AddReport(Nmap.NmapReport nmap) { ReportTemplate report = this; foreach (Nmap.Host host in nmap.Hosts) { ReportTemplate.Host newHost = new ReportTemplate.Host() { IPAddress = host.IPAddress }; foreach (Nmap.Port p in host.PortsInformation.Ports) { ReportTemplate.Port open = new ReportTemplate.Port() { Number = p.Number, Protocol = p.Protocol, Severity = 2, ThreatLevel = "Medium", Description = "Port " + p.Number + " open for " + p.Service.ServiceProduct ?? p.Service.ServiceName, Tool = "nmap" }; newHost.OpenPorts.Add(open); } newHost.OperatingSystem = (from p in host.PortsInformation.Ports where p.Service.OperatingSystem != null group p by p.Service.OperatingSystem into sp orderby sp.Count() descending select sp).First().Key; report.Hosts.Add(newHost); } FixAdd(); }
public void AddReport(DynamicHostList dynamicPlugin) { ReportTemplate report = this; foreach (DynamicHost host in dynamicPlugin.Hosts) { ReportTemplate.Host newHost = new ReportTemplate.Host() { IPAddress = host.IP, ComputerName = host.Name != null ? host.Name : "", OperatingSystem = host.OperatingSystem != null ? host.OperatingSystem : "" }; foreach (DynamicPortList list in host.PortList) { foreach (DynamicPort port in list.OpenPorts) { int fail; ReportTemplate.Port open = new ReportTemplate.Port() { Number = Convert.ToInt32(port.Number), Protocol = port.Protocol != null ? port.Protocol : "", Severity = int.TryParse(port.Severity, out fail) ? Convert.ToInt32(port.Severity) : 2, ThreatLevel = port.ThreatLevel != null ? port.ThreatLevel : "Low", Description = port.Description != null ? port.Description : "", Tool = dynamicPlugin.ToolName }; newHost.OpenPorts.Add(open); } } report.Hosts.Add(newHost); } }