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); }
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); }
/// <summary> /// Gets registrars for all companies in our database /// </summary> internal void GetAllEmailHosts() { MarketShareDataSource mds = DroneDataSource as MarketShareDataSource; if (!Object.Equals(null, mds)) { using (Dig dig = new Dig()) { var list = mds.GetAllCompanies(MarketShareTypeBitMaskEnum.EmailHost, XMLUtility.GetIntFromAccountNode(Xml, "emailhost/recordcount")); foreach (var company in list) { try { MarketShareDataType marketType = new MarketShareDataType(); string url = Utility.CleanUrl(company.Uri.ToString()); if (!String.IsNullOrWhiteSpace(url)) { WriteToUsageLogFile("Domain:" + url, string.Format("Executing {0}.{1}", ComponentTypeName, MethodInfo.GetCurrentMethod().Name), true); marketType.Value = dig.GetEmailHostName(url); marketType.DomainId = company.DomainId; marketType.SampleDate = company.DomainAttributes["SampleDate"]; marketType.TypeId = (int)MarketShareDataTypeEnum.EmailHost; marketType.BitMaskId = (int)MarketShareTypeBitMaskEnum.EmailHost; if (!string.IsNullOrWhiteSpace(marketType.Value)) { MarketShareDataComponent dc = new MarketShareDataComponent(); dc.MarketShareType = marketType; DroneDataSource.Process(dc); } else { Utility.WriteToLogFile(String.Format("SmallBiz_NoEmailHost_{0:M_d_yyyy}", DateTime.Today) + ".log", string.Format("Domain: ,{0}", url)); } } } catch (Exception e) { ExceptionExtensions.LogError(e, "EmailHost.GetAllEmailHosts", "Domain: " + company.Uri.ToString()); } } } } }