コード例 #1
0
        static void FetchDate()
        {
            Whois.Parsers.WhoisParser whoisParser = new Whois.Parsers.WhoisParser();
            foreach (var p in db.DomainDetails.Where(x => x.HasDate == null && x.IsPing == true))
            {
                Console.WriteLine($"Fetch Date => {p.Name}");
                WhoisResponse d  = WhoisClient.Query(p.Name);
                var           d2 = whoisParser.Parse(d.RespondedServers[d.RespondedServers.Length - 1], d.Raw);

                if (d2.Registered != null && d2.Updated != null && d2.Expiration != null)
                {
                    p.HasDate    = true;
                    p.RegisterAt = d2.Registered;
                    p.UpdateAt   = d2.Updated;
                    p.ExpiryAt   = d2.Expiration;

                    RecCount++;
                }
                else
                {
                    long n = EMailExtract.NetConnectionCheckAndWait();
                    if (n == 1)
                    {
                        p.HasDate = false;
                        RecCount++;
                    }
                    else
                    {
                        d  = WhoisClient.Query(p.Name);
                        d2 = whoisParser.Parse(d.RespondedServers[d.RespondedServers.Length - 1], d.Raw);

                        if (d2.Registered != null && d2.Updated != null && d2.Expiration != null)
                        {
                            p.HasDate    = true;
                            p.RegisterAt = d2.Registered;
                            p.UpdateAt   = d2.Updated;
                            p.ExpiryAt   = d2.Expiration;
                            RecCount++;
                        }
                        else
                        {
                            p.HasDate = false;
                            RecCount++;
                        }
                    }
                }
                if (EMailExtract.escPressed)
                {
                    return;
                }
            }
        }
コード例 #2
0
        static void DomainNameStore()
        {
            EMailExtract EME = new EMailExtract();

            if (!EME.InputDirExists)
            {
                Console.WriteLine($"{EME.InputDir} does not exist.");
                return;
            }

            foreach (var file in EME.FileDetails)
            {
                FileDetail f = new FileDetail()
                {
                    Name = file.Name, DomainDetails = new List <DomainDetail>()
                };
                db.FileDetails.Add(f);
                RecCount++;
                Console.WriteLine($"File => {file.Name}");
                FileInfo fIn = new FileInfo($"input/{file.Name}");
                foreach (var s in File.ReadAllLines(fIn.FullName))
                {
                    Console.WriteLine(s);
                    f.DomainDetails.Add(new DomainDetail()
                    {
                        Name = s
                    });
                    RecCount++;
                    if (EMailExtract.escPressed)
                    {
                        return;
                    }
                }
                if (EMailExtract.escPressed)
                {
                    return;
                }
            }
            DBSave();
        }
コード例 #3
0
 static void PingDomain()
 {
     foreach (var p in db.DomainDetails.Where(x => x.IsPing == null))
     {
         bool r = EMailExtract.PingHost(p.Name);
         if (r == true)
         {
             p.IsPing = true;
             RecCount++;
         }
         else
         {
             long n = EMailExtract.NetConnectionCheckAndWait();
             p.IsPing = (n == 1)? false : EMailExtract.PingHost(p.Name);
             RecCount++;
         }
         if (EMailExtract.escPressed)
         {
             return;
         }
     }
 }