Пример #1
0
        public override Task <ModuleResult> Execute(Data data)
        {
            if (!CheckValidHost())
            {
                return(Task.FromResult(ModuleResult.Create(this, ResultType.Error, "This is not a valid host.")));
            }

            var successful = GetCertificate();

            if (_certificate == null)
            {
                return(Task.FromResult(ModuleResult.Create(this, ResultType.Error, "The host does not have a valid SSL Certificate.")));
            }
            if (!successful)
            {
                return(Task.FromResult(ModuleResult.Create(this, ResultType.Error, "The host does not have a valid SSL Certificate.")));
            }

            _certificateResults.Add("Valid from: " + _certificate.GetEffectiveDateString());
            _certificateResults.Add("Valid till: " + _certificate.GetExpirationDateString());
            _certificateResults.Add("Signature algorithm: " + _certificate.SignatureAlgorithm.FriendlyName);

            var result = _certificateResults.Aggregate(_host + " has a valid SSL Certificate.", (current, cResult) => current + Environment.NewLine + cResult);

            return(Task.FromResult(ModuleResult.Create(this, ResultType.Success, result)));
        }
Пример #2
0
        public override async Task <ModuleResult> Execute(Data data)
        {
            var stopWatch = new Stopwatch();

            stopWatch.Start();

            var pathList = await GetPathTraversalList("https://raw.githubusercontent.com/Bo0oM/fuzz.txt/master/fuzz.txt");

            ExecutePathTraversal(_host, pathList);
            var result = string.Join(Environment.NewLine, _foundHost);

            stopWatch.Stop();
            result += $"{ Environment.NewLine } Pathtraversal completed in: { stopWatch.Elapsed.TotalSeconds } seconds";

            return(ModuleResult.Create(this, ResultType.Success, result));
        }
Пример #3
0
        public override async Task <ModuleResult> Execute(Data data)
        {
            IPAddress hostip = data.GetData <IPAddress>("LocalIpAddress");

            await CompareServiceData(hostip.ToString());

            string denials = "";

            if (!serviceDenials.Any())
            {
                return(ModuleResult.Create(this, ResultType.Success, "All hosts' services are up!"));
            }
            else
            {
                foreach (Denial d in serviceDenials)
                {
                    denials += Environment.NewLine + d.IP + " - denials - " + d.ServiceDenialed;
                }
                return(ModuleResult.Create(this, ResultType.Warning, denials));
            }
        }
Пример #4
0
        public override Task <ModuleResult> Execute(Data data)
        {
            if (!string.IsNullOrEmpty(_hostExtension))
            {
                Logger.Log(LogType.Info, $"Getting whois information for host: " + _host);
            }
            else
            {
                Logger.Log(LogType.Error, $"Unable to find whois server for host (is your host extension invalid?): " + _host);

                return(Task.FromResult(ModuleResult.Create(this, ResultType.Error,
                                                           "Unable to find whois server for host (is your host extension invalid?): " + _host)));
            }

            if (TryGetWhoisInfo(out string whoIs))
            {
                return(Task.FromResult(ModuleResult.Create(this, ResultType.Warning,
                                                           $"WhoIs information has been found, check if it contains personal information and if so, contact your domain provider:\n\r\n\r{whoIs}")));
            }

            return(Task.FromResult(ModuleResult.Create(this, ResultType.Error, $"No whois information could be found for host: " + _host)));
        }
Пример #5
0
        public override async Task <ModuleResult> Execute(Data data)
        {
            string ipAddress = data.GetData <string>("IpAddress");

            Logger.Log(LogType.Info, $"Starting port scan (TCP) on {ipAddress}...");
            Logger.Log(LogType.Info, $""); //empty line to show "... ports left." later

            ConcurrentBag <int> openTcpPorts = new ConcurrentBag <int>();

            ConcurrentQueue <int> portQueue = new ConcurrentQueue <int>(Enumerable.Range(0, 65535));

            int threadCount = 1024;

            List <Thread> threads = new List <Thread>();

            int leftCursorPosition = $"[{LogType.Info}] ".Length;
            int topCursorPosition  = Console.CursorTop - 1;

            object lockObject = new object();

            for (int j = 0; j < threadCount; j++)
            {
                Thread thread = new Thread(() =>
                {
                    while (!portQueue.IsEmpty)
                    {
                        if (portQueue.TryDequeue(out int port))
                        {
                            if (TryConnectTcp(ipAddress, port))
                            {
                                openTcpPorts.Add(port);
                            }

                            if (portQueue.Count % 100 == 0)
                            {
                                lock (lockObject)
                                {
                                    Console.SetCursorPosition(leftCursorPosition, topCursorPosition);
                                    Console.Write($"{portQueue.Count} ports left.");
                                }
                            }
                        }
                    }
                });

                thread.IsBackground = true;
                thread.Start();
                threads.Add(thread);
            }

            while (threads.Any(thread => thread.IsAlive))
            {
                await Task.Delay(1000);
            }

            Console.WriteLine(); //make sure the console text coming next will start on a new line

            threads.Clear();

#if DEBUG
            foreach (int openTcpPort in openTcpPorts)
            {
                Logger.Log(LogType.Info, $"Port {openTcpPort} (TCP) is open.");
            }
#endif

            //TODO implement UDP scan that works
            //Logger.Log(LogType.Info, $"Starting port scan (UDP) on {ipAddress}...");

            //List<int> openUdpPorts = new List<int>();

            //for (int j = 0; j < threadCount; j++)
            //{
            //    Thread thread = new Thread(() =>
            //    {
            //        while (!portQueue.IsEmpty)
            //        {
            //            if (portQueue.TryDequeue(out int port))
            //            {
            //                if (TryConnectUdp(ipAddress, port))
            //                {
            //                    openUdpPorts.Add(port);
            //                }
            //            }
            //        }
            //    });

            //    thread.IsBackground = true;
            //    thread.Start();
            //    threads.Add(thread);
            //}

            //while (threads.Any(thread => thread.IsAlive))
            //{
            //    await Task.Delay(1000);
            //}

            //foreach (int openUdpPort in openUdpPorts)
            //{
            //    Logger.Log(LogType.Info, $"Port {openUdpPort} (UDP) is open.");
            //}

            if (openTcpPorts.Count > 0)
            {
                return(ModuleResult.Create(this, ResultType.Error, $"Found some open ports on {ipAddress}:\n\r" +
                                           string.Join(" (TCP) is open!" + Environment.NewLine, openTcpPorts) + " (TCP) is open!"));
            }

            return(ModuleResult.Create(this, ResultType.Success, $"No open ports found on {ipAddress}!"));
        }
Пример #6
0
        public override Task <ModuleResult> Execute(Data data)
        {
            string hostip = data.GetData <string>("IpAddress");

            return(Task.FromResult(ModuleResult.Create(this, ResultType.Success, CheckInternetSpeed().ToString() + " kb/s")));
        }