Esempio n. 1
0
        public IToolResults Run()
        {
            string cmd, output;

            cmd = "-w 10 -dd " + _options.Host + ":" + _options.Port;

            ProcessStartInfo si = new ProcessStartInfo();

            si.RedirectStandardOutput = true;
            si.UseShellExecute        = false;

            Process proc = new Process();

            proc.StartInfo           = si;
            proc.EnableRaisingEvents = false;
            proc.StartInfo.FileName  = _options.Path;
            proc.StartInfo.Arguments = cmd;
            proc.Start();

            proc.WaitForExit();

            output = proc.StandardOutput.ReadToEnd();

            SSLScanToolResults results = new SSLScanToolResults(output);

            return(results);
        }
 public PersistentSSLScanResults(SSLScanToolResults results)
 {
     this.FullOutput = results.FullOutput;
     this.HostPortID = results.HostPortID;
     this.HostIPAddressV4 = results.HostIPAddressV4;
     this.HostPort = results.HostPort;
     this.IsTCP = results.IsTCP;
 }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        public IToolResults Run()
        {
            string cmd, output;

            cmd = "-w 10 -dd " + _options.Host + ":" + _options.Port;

            ProcessStartInfo si = new ProcessStartInfo();
            si.RedirectStandardOutput = true;
            si.UseShellExecute = false;

            Process proc = new Process();

            proc.StartInfo = si;
            proc.EnableRaisingEvents = false;
            proc.StartInfo.FileName = _options.Path;
            proc.StartInfo.Arguments = cmd;
            proc.Start();

            proc.WaitForExit();

            output = proc.StandardOutput.ReadToEnd();

            SSLScanToolResults results = new SSLScanToolResults(output);

            return results;
        }