Beispiel #1
0
        public void DigSSLCert()
        {
            Dig dig = new Dig();

            SSLCert cert = dig.GetSSLVerification("godaddy.com");

            Assert.IsNotNull(cert);
            Assert.IsNotNull(cert.IssuerName);
            Assert.IsNotNull(cert.SubjectType);
            Assert.AreEqual("www.godaddy.com", cert.SubjectType);

            cert = dig.GetSSLVerification("1footout.com");
            Assert.AreEqual(cert.FixedName, "None");
        }
Beispiel #2
0
        internal CompanyRoot GetFullCompany(string permalinkName, Dig digMgr)
        {
            CompanyRoot company = compManager.GetFullCompany(permalinkName);

            if (!Object.Equals(company, null) && !Object.Equals(null, company.homepage_url))
            {
                Records r = new Records();
                company.homepage_url = Utility.CleanUrl(company.homepage_url);
                IPAddress ip = digMgr.GetIPAddress(company.homepage_url);
                if (!Object.Equals(null, ip))
                {
                    company.ip_address = ip.ToString();
                }
                SSLCert cert = digMgr.GetSSLVerification(company.homepage_url);

                if (!Object.Equals(cert, null))
                {
                    r.SSLIssuer       = cert.FixedName;
                    r.CertificateType = cert.SubjectType;
                }
                r.WebHost   = digMgr.GetWebHostName(company.homepage_url);
                r.EmailHost = digMgr.GetEmailHostName(company.homepage_url);
                r.DNSHost   = digMgr.GetDNSHostName(company.homepage_url);
                r.Registrar = digMgr.GetRegistrar(company.homepage_url);

                company.records = r;
            }

            return(company);
        }
Beispiel #3
0
        public void FindCompanyInLookups()
        {
            Dig dig = new Dig();

            string foundName = dig.GetRegistrar("1computer.info");

            Assert.AreEqual("Network Solutions", foundName);

            //self hosted
            foundName = dig.GetEmailHostName("fash-art.com");
            Assert.AreEqual("Self Hosted", foundName);

            foundName = dig.GetEmailHostName("blooclick.com");
            Assert.AreEqual("ovh systems", foundName.ToLower());

            //email
            foundName = dig.GetEmailHostName("sawyerit.com");
            Assert.AreEqual("Go Daddy", foundName);

            //not found, use record
            foundName = dig.GetDNSHostName("travellution.com");
            Assert.AreEqual("technorail.com", foundName);

            //found, use company name
            foundName = dig.GetDNSHostName("godaddy.com");
            Assert.AreEqual("Go Daddy", foundName);

            //no SSL issuer
            foundName = dig.GetCompanyFromRecordName(dig.GetSSLVerification("cybergeekshop.com").IssuerName, "cybergeekshop.com", DigTypeEnum.SSL);
            Assert.AreEqual("None", foundName);

            //webhost (split AS name with -)
            foundName = dig.GetWebHostName("cybergeekshop.com");
            Assert.AreEqual("Unified Layer", foundName);

            foundName = dig.GetWebHostName("microteksystems.net");
            Assert.AreEqual("SoftLayer", foundName);

            //webhost (splitting AS Name without -)
            foundName = dig.GetWebHostName("eatads.com");
            Assert.AreEqual("Amazon", foundName);
        }
Beispiel #4
0
        private void DoSSLCheck()
        {
            MarketShareDataSource mds = DroneDataSource as MarketShareDataSource;

            if (!Object.Equals(null, mds))
            {
                int maxParallel = XMLUtility.GetTextFromAccountNode(Xml, ProcessorName + "/maxparallel").ConvertStringToInt(1);
                Dig dig         = new Dig();

                Parallel.ForEach(mds.GetAllCompanies(MarketShareTypeBitMaskEnum.SSLIssuer, XMLUtility.GetIntFromAccountNode(Xml, ProcessorName + "/recordcount"))
                                 , new ParallelOptions {
                    MaxDegreeOfParallelism = maxParallel
                }
                                 , (company, state) =>
                {
                    try
                    {
                        if (Context.ShuttingDown)
                        {
                            state.Break();
                        }

                        MarketShareDataType marketType = new MarketShareDataType();
                        string url = Utility.CleanUrl(company.Uri.ToString());
                        WriteToUsageLogFile("Domain:" + url, string.Format("Executing {0}.{1}", ComponentTypeName, MethodInfo.GetCurrentMethod().Name), true);

                        if (!String.IsNullOrWhiteSpace(url))
                        {
                            SSLCert cert = dig.GetSSLVerification(url);
                            if (!Object.Equals(cert, null))
                            {
                                MarketShareDataComponent dc = new MarketShareDataComponent();

                                //Issuer
                                marketType.Value      = cert.FixedName;
                                marketType.DomainId   = company.DomainId;
                                marketType.SampleDate = company.DomainAttributes["SampleDate"];
                                marketType.TypeId     = (int)MarketShareDataTypeEnum.SSLIssuer;
                                marketType.BitMaskId  = (int)MarketShareTypeBitMaskEnum.SSLIssuer;
                                dc.MarketShareType    = marketType;
                                DroneDataSource.Process(dc);

                                //CertType
                                marketType.Value     = cert.SubjectType;
                                marketType.TypeId    = (int)MarketShareDataTypeEnum.CertificateType;
                                marketType.BitMaskId = (int)MarketShareTypeBitMaskEnum.CertificateType;
                                dc.MarketShareType   = marketType;
                                DroneDataSource.Process(dc);
                            }
                            else
                            {
                                Utility.WriteToLogFile(String.Format("SmallBiz_NoSSLInfo_{0:M_d_yyyy}", DateTime.Today) + ".log", string.Format("Domain: ,{0}", url));
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        ExceptionExtensions.LogError(e, "SSLCheck.DoSSLCheck", "Domain: " + company.Uri.ToString());
                    }
                });
            }
        }