Example #1
0
        public AnalysisResult GetFuzzyDomains(string domain)
        {
            var domains = _twisterHttpClient.GetFuzzyDomains(domain);

            var finderDomains = Map(domains.FuzzyDomainList);

            var tasks = new Dictionary <FinderDomain, Task <bool> >();

            //Create tasks
            foreach (var finderDomain in finderDomains)
            {
                tasks[finderDomain] = _dnsResolver.GetHostEntry(finderDomain.Domain);
            }

            //Fire all tasks async
            Task.WaitAll(tasks.Values.ToArray());

            //Validate Result
            foreach (var task in tasks)
            {
                var resultDomain = task.Key;
                resultDomain.IsValidDomain = task.Value.Result;

                if (resultDomain.IsValidDomain)
                {
                    resultDomain.ScreenshotImageUrl = _imageRenderService.GenerateImageUrl(resultDomain.Domain);
                }
            }

            //Group Results by Algorithm Type
            var result = new AnalysisResult
            {
                SearchResult     = finderDomains,
                ResultStatistics = BuildAlgorithmResultStatisics(finderDomains)
            };

            return(result);
        }