public OneSixtyOne(IToolOptions options) { if (options is OneSixtyOneToolOptions) { _options = (OneSixtyOneToolOptions)options; } }
public OneSixtyOne(IToolOptions options) { if (options is OneSixtyOneToolOptions) _options = (OneSixtyOneToolOptions)options; }
private void ScanHost(NMapHost host, out List <IToolResults> toolResults) { IToolOptions _options; string eventDescription; toolResults = new List <IToolResults> (); bool routed = false; int tries = 0; foreach (Port port in host.Ports) { if (port.Service == "http") { _options = new NiktoToolOptions(); (_options as NiktoToolOptions).Host = host.IPAddressv4; (_options as NiktoToolOptions).Port = port.PortNumber; (_options as NiktoToolOptions).Path = this.Configuration ["niktoPath"]; Nikto nikto = new Nikto(_options); eventDescription = "Running nikto (http) on host: " + (string.IsNullOrEmpty(host.Hostname) ? host.IPAddressv4 : host.Hostname); CreateEvent(DateTime.Now, eventDescription, 1); Console.WriteLine(eventDescription); NiktoToolResults niktoResults = (nikto.Run() as NiktoToolResults); niktoResults.HostIPAddressV4 = host.IPAddressv4; niktoResults.HostPort = port.PortNumber; niktoResults.IsTCP = true; toolResults.Add(niktoResults); } else if (port.Service == "https") { _options = new SSLScanToolOptions(); (_options as SSLScanToolOptions).Host = host.IPAddressv4; (_options as SSLScanToolOptions).Port = port.PortNumber; (_options as SSLScanToolOptions).Path = this.Configuration ["sslscanPath"]; SSLScan sslscan = new SSLScan(_options); eventDescription = "Running sslscan (https) on host: " + (string.IsNullOrEmpty(host.Hostname) ? host.IPAddressv4 : host.Hostname); CreateEvent(DateTime.Now, eventDescription, 1); Console.WriteLine(eventDescription); SSLScanToolResults sslResults = (sslscan.Run() as SSLScanToolResults); sslResults.HostIPAddressV4 = host.IPAddressv4; sslResults.HostPort = port.PortNumber; sslResults.IsTCP = true; toolResults.Add(sslResults); _options = new NiktoToolOptions(); (_options as NiktoToolOptions).Host = host.IPAddressv4; (_options as NiktoToolOptions).Port = port.PortNumber; (_options as NiktoToolOptions).IsSSL = true; (_options as NiktoToolOptions).Path = this.Configuration ["niktoPath"]; Nikto nikto = new Nikto(_options); eventDescription = "Running nikto (https) on host: " + (string.IsNullOrEmpty(host.Hostname) ? host.IPAddressv4 : host.Hostname); CreateEvent(DateTime.Now, eventDescription, 1); Console.WriteLine(eventDescription); NiktoToolResults niktoResults = (nikto.Run() as NiktoToolResults); niktoResults.HostIPAddressV4 = host.IPAddressv4; niktoResults.HostPort = port.PortNumber; niktoResults.IsTCP = true; toolResults.Add(niktoResults); } else if (port.Service == "ssh") { _options = new SSLScanToolOptions(); (_options as SSLScanToolOptions).Host = host.IPAddressv4; (_options as SSLScanToolOptions).Port = port.PortNumber; (_options as SSLScanToolOptions).Path = this.Configuration ["sslscanPath"]; SSLScan sslscan = new SSLScan(_options); eventDescription = "Running sslscan (ssh) on host: " + (string.IsNullOrEmpty(host.Hostname) ? host.IPAddressv4 : host.Hostname); CreateEvent(DateTime.Now, eventDescription, 1); Console.WriteLine(eventDescription); SSLScanToolResults sslResults = (sslscan.Run() as SSLScanToolResults); sslResults.HostIPAddressV4 = host.IPAddressv4; sslResults.HostPort = port.PortNumber; sslResults.IsTCP = true; toolResults.Add(sslResults); } else if (port.PortNumber == 445) //smb { _options = new SMBClientToolOptions(); (_options as SMBClientToolOptions).Host = host.IPAddressv4; (_options as SMBClientToolOptions).RecurseShares = true; (_options as SMBClientToolOptions).Path = this.Configuration ["smbclientPath"]; SMBClient smb = new SMBClient(_options); eventDescription = "Running smbclient (cifs) on host: " + (string.IsNullOrEmpty(host.Hostname) ? host.IPAddressv4 : host.Hostname); CreateEvent(DateTime.Now, eventDescription, 1); Console.WriteLine(eventDescription); SMBClientToolResults smbResults = smb.Run() as SMBClientToolResults; smbResults.ParentPort = port; smbResults.HostIPAddressV4 = host.IPAddressv4; smbResults.HostPort = port.PortNumber; smbResults.IsTCP = true; toolResults.Add(smbResults); eventDescription = string.Format("Found {0} shares on host {1}", smbResults.ShareDetails.Count, host.Hostname); CreateEvent(DateTime.Now, eventDescription, 1); Console.WriteLine(eventDescription); } else if (port.Service == "snmp") { _options = new OneSixtyOneToolOptions(); (_options as OneSixtyOneToolOptions).Host = host.IPAddressv4; (_options as OneSixtyOneToolOptions).Path = this.Configuration ["onesixtyonePath"]; OneSixtyOne onesixone = new OneSixtyOne(_options); eventDescription = "Running onesixtyone (snmp) on host: " + (string.IsNullOrEmpty(host.Hostname) ? host.IPAddressv4 : host.Hostname); CreateEvent(DateTime.Now, eventDescription, 1); Console.WriteLine(eventDescription); OneSixtyOneToolResults osoResults = onesixone.Run() as OneSixtyOneToolResults; osoResults.HostIPAddressV4 = host.IPAddressv4; osoResults.HostPort = port.PortNumber; osoResults.IsTCP = true; toolResults.Add(osoResults); } } eventDescription = "Finished host " + (string.IsNullOrEmpty(host.Hostname) ? host.IPAddressv4 : host.Hostname); CreateEvent(DateTime.Now, eventDescription, 1); Console.WriteLine(eventDescription); }
private void ScanHost(NMapHost host, out List<IToolResults> toolResults) { IToolOptions _options; string eventDescription; toolResults = new List<IToolResults> (); bool routed = false; int tries = 0; foreach (Port port in host.Ports) { if (port.Service == "http") { _options = new NiktoToolOptions (); (_options as NiktoToolOptions).Host = host.IPAddressv4; (_options as NiktoToolOptions).Port = port.PortNumber; (_options as NiktoToolOptions).Path = this.Configuration ["niktoPath"]; Nikto nikto = new Nikto (_options); eventDescription = "Running nikto (http) on host: " + (string.IsNullOrEmpty (host.Hostname) ? host.IPAddressv4 : host.Hostname); CreateEvent(DateTime.Now, eventDescription, 1); Console.WriteLine(eventDescription); NiktoToolResults niktoResults = (nikto.Run () as NiktoToolResults); niktoResults.HostIPAddressV4 = host.IPAddressv4; niktoResults.HostPort = port.PortNumber; niktoResults.IsTCP = true; toolResults.Add (niktoResults); } else if (port.Service == "https") { _options = new SSLScanToolOptions (); (_options as SSLScanToolOptions).Host = host.IPAddressv4; (_options as SSLScanToolOptions).Port = port.PortNumber; (_options as SSLScanToolOptions).Path = this.Configuration ["sslscanPath"]; SSLScan sslscan = new SSLScan (_options); eventDescription = "Running sslscan (https) on host: " + (string.IsNullOrEmpty (host.Hostname) ? host.IPAddressv4 : host.Hostname); CreateEvent(DateTime.Now, eventDescription, 1); Console.WriteLine(eventDescription); SSLScanToolResults sslResults = (sslscan.Run () as SSLScanToolResults); sslResults.HostIPAddressV4 = host.IPAddressv4; sslResults.HostPort = port.PortNumber; sslResults.IsTCP = true; toolResults.Add (sslResults); _options = new NiktoToolOptions (); (_options as NiktoToolOptions).Host = host.IPAddressv4; (_options as NiktoToolOptions).Port = port.PortNumber; (_options as NiktoToolOptions).IsSSL = true; (_options as NiktoToolOptions).Path = this.Configuration ["niktoPath"]; Nikto nikto = new Nikto (_options); eventDescription = "Running nikto (https) on host: " + (string.IsNullOrEmpty (host.Hostname) ? host.IPAddressv4 : host.Hostname); CreateEvent(DateTime.Now, eventDescription, 1); Console.WriteLine(eventDescription); NiktoToolResults niktoResults = (nikto.Run () as NiktoToolResults); niktoResults.HostIPAddressV4 = host.IPAddressv4; niktoResults.HostPort = port.PortNumber; niktoResults.IsTCP = true; toolResults.Add (niktoResults); } else if (port.Service == "ssh") { _options = new SSLScanToolOptions (); (_options as SSLScanToolOptions).Host = host.IPAddressv4; (_options as SSLScanToolOptions).Port = port.PortNumber; (_options as SSLScanToolOptions).Path = this.Configuration ["sslscanPath"]; SSLScan sslscan = new SSLScan (_options); eventDescription = "Running sslscan (ssh) on host: " + (string.IsNullOrEmpty (host.Hostname) ? host.IPAddressv4 : host.Hostname); CreateEvent(DateTime.Now, eventDescription, 1); Console.WriteLine(eventDescription); SSLScanToolResults sslResults = (sslscan.Run () as SSLScanToolResults); sslResults.HostIPAddressV4 = host.IPAddressv4; sslResults.HostPort = port.PortNumber; sslResults.IsTCP = true; toolResults.Add (sslResults); } else if (port.PortNumber == 445) { //smb _options = new SMBClientToolOptions (); (_options as SMBClientToolOptions).Host = host.IPAddressv4; (_options as SMBClientToolOptions).RecurseShares = true; (_options as SMBClientToolOptions).Path = this.Configuration ["smbclientPath"]; SMBClient smb = new SMBClient (_options); eventDescription = "Running smbclient (cifs) on host: " + (string.IsNullOrEmpty (host.Hostname) ? host.IPAddressv4 : host.Hostname); CreateEvent(DateTime.Now, eventDescription, 1); Console.WriteLine(eventDescription); SMBClientToolResults smbResults = smb.Run () as SMBClientToolResults; smbResults.ParentPort = port; smbResults.HostIPAddressV4 = host.IPAddressv4; smbResults.HostPort = port.PortNumber; smbResults.IsTCP = true; toolResults.Add (smbResults); eventDescription = string.Format("Found {0} shares on host {1}", smbResults.ShareDetails.Count, host.Hostname); CreateEvent(DateTime.Now, eventDescription, 1); Console.WriteLine(eventDescription); } else if (port.Service == "snmp") { _options = new OneSixtyOneToolOptions (); (_options as OneSixtyOneToolOptions).Host = host.IPAddressv4; (_options as OneSixtyOneToolOptions).Path = this.Configuration ["onesixtyonePath"]; OneSixtyOne onesixone = new OneSixtyOne (_options); eventDescription = "Running onesixtyone (snmp) on host: " + (string.IsNullOrEmpty (host.Hostname) ? host.IPAddressv4 : host.Hostname); CreateEvent(DateTime.Now, eventDescription, 1); Console.WriteLine(eventDescription); OneSixtyOneToolResults osoResults = onesixone.Run () as OneSixtyOneToolResults; osoResults.HostIPAddressV4 = host.IPAddressv4; osoResults.HostPort = port.PortNumber; osoResults.IsTCP = true; toolResults.Add (osoResults); } } eventDescription = "Finished host " + (string.IsNullOrEmpty (host.Hostname) ? host.IPAddressv4 : host.Hostname); CreateEvent(DateTime.Now, eventDescription, 1); Console.WriteLine(eventDescription); }