コード例 #1
0
ファイル: DigTests.cs プロジェクト: sawyerit/crawler
        public void DigASN()
        {
            Dig    dig    = new Dig();
            string record = dig.GetASN(dig.GetIPAddress("dreamsencashed.com").ToString());

            Assert.AreEqual("17439", record);
        }
コード例 #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);
        }
コード例 #3
0
        public void DigIPAddress()
        {
            IPAddress record = _dig.GetIPAddress("takenbakesites.com");

            Assert.IsNotNull(record);
            Assert.IsFalse(String.IsNullOrEmpty(record.ToString()));
            Assert.AreEqual("50.63.202.53", record.ToString());
        }
コード例 #4
0
ファイル: DigTests.cs プロジェクト: sawyerit/crawler
        public void DigIPAddress()
        {
            Dig       dig    = new Dig();
            IPAddress record = dig.GetIPAddress("godaddy.com");

            Assert.IsNotNull(record);
            Assert.IsFalse(String.IsNullOrEmpty(record.ToString()));
            Assert.AreEqual("97.74.104.201", record.ToString());
        }
コード例 #5
0
        public void IsIPParked()
        {
            Dig       dig    = new Dig();
            IPAddress record = dig.GetIPAddress("takenbakesites.com");

            bool isParked = IPAddressRange.IsInRange(record);

            IPAddressRange.IsInRange(record);

            Assert.IsTrue(isParked);

            record = dig.GetIPAddress("godaddy.com");

            isParked = IPAddressRange.IsInRange(record);
            IPAddressRange.IsInRange(record);

            Assert.IsTrue(!isParked);
        }
コード例 #6
0
        public void WebHostLookup_FromZoneSample()
        {
            Dig dig = new Dig();
            //copy the file because we are going to delete as we go instead of holding a million records in memory
            string masterFile = "PortSample.txt";
            string tempFile   = "temp_" + masterFile;
            string tempLine   = string.Empty;


            List <string> webhostList = new List <string>();
            List <string> errorList   = new List <string>();
            string        header      = string.Empty;
            int           statCode    = 0;
            int           counter     = 0;

            // Ensure that the target does not exist.
            File.Copy(masterFile, tempFile, true);
            try
            {
                //read lines from tempfile & parse it
                using (StreamReader r = new StreamReader(tempFile))
                {
                    // Use while != null pattern for loop
                    while ((tempLine = r.ReadLine()) != null)
                    {
                        if (!String.IsNullOrWhiteSpace(tempLine))
                        {
                            //we have a line, parse the tabs and call webhost lookups
                            //string[] seperator = { "\t" };
                            string[] seperator = { "|" };
                            string[] cols      = tempLine.Split(seperator, StringSplitOptions.RemoveEmptyEntries);
                            counter++;

                            if (cols.Length > 0)
                            {
                                IPAddress addr = null;
                                addr = dig.GetIPAddress(Utility.CleanUrl(cols[0]));
                                if (addr != null)
                                {
                                    header = string.Empty;
                                }
                                statCode = 0;
                                try
                                {
                                    CheckHead(ref statCode, ref header, cols[0]);
                                }
                                catch (Exception)
                                {
                                    errorList.Add("headrequest timed out");
                                }

                                try
                                {
                                    //add host to list
                                    if (statCode == 301)
                                    {
                                        webhostList.Add(dig.GetWebHostName(Utility.CleanUrl(header)));
                                    }
                                    else
                                    {
                                        webhostList.Add(dig.GetWebHostName(cols[0]));
                                    }
                                }
                                catch (Exception)
                                {
                                    webhostList.Add("webhost timed out");
                                }
                            }
                        }
                    }

                    List <string> timeoutList    = webhostList.Where(item => item == "headrequest timed out").ToList();
                    List <string> webtimeoutList = webhostList.Where(item => item == "webhost timed out").ToList();
                }

                File.Delete(tempFile);
            }
            catch (Exception)
            {
                throw;
            }
            //do lookup

            //write data
        }