• 0

Small powerful script to dump all .com's & their status into a db


Question

Hi all,

Thought this might be useful to someone, so I'm releasing it into the wild! It creates a database that looks like this:

post-176093-0-87487100-1322016228.png

Mod's: this is completely above-board... WHOIS is provided by InterNIC via port 43 for unlimited free lookups.

Enjoy! :D

CREATE TABLE `domains` (
  `domain` varchar(6) NOT NULL,
  `len` tinyint(1) unsigned NOT NULL,
  `available` tinyint(1) unsigned NOT NULL,
  `expires` date NOT NULL,
  `checked` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`domain`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

<?php
set_time_limit(0);

$dbhost = 'localhost';
$dbuser = 'foo';
$dbpass = 'bar';
$dbname = 'whois';

$dh = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname);
for($i = 'aaa'; $i <= 'zzzz'; $i++)
{
$len = strlen($i);
if($conn = fsockopen ('whois.internic.net', 43))
{
  $output = NULL;
  fputs($conn, "domain $i.com\r\n");
  while(!feof($conn))
  {
   $output .= fgets($conn, 128);
  }
  fclose($conn);
}
if(strpos($output, 'No match for domain') !== FALSE)
  mysql_query("INSERT INTO `domains` VALUES ('$i', '$len', 1, '0000-00-00', NULL);") or die($i . ' - ' .mysql_error());
else
{
  preg_match('/Expiration Date: (.+?)\n/', $output, $expires);
  $expires = strtotime($expires[1]);
  $expires = date('Y-m-d', $expires);
  mysql_query("INSERT INTO `domains` VALUES ('$i', '$len', 0, '$expires', NULL);") or die($i . ' - ' .mysql_error());
}
}
mysql_close($dh);
?>

  • Like 1

12 answers to this question

Recommended Posts

  • 0

Well this script finally finished going from aaa to zzzz in about 36 hours. None of the domains were available, but around 1500 of them have expired. I've attached the list of expired .com domains in Excel format if anyone wants it. Can't upload any file ending .csv, .xls, or .xlsx - wtf Neowin?!

They first go into a period of redemption, where the original owner can claim them back for about 80 days after it expires. Then they go into pendingDelete, and 5 calendar days later, they're free to whoever can claim them first!

Oh, and you can query any of these WHOIS servers via port 43:

http://www.nirsoft.net/whois-servers.txt

ac whois.nic.ac

ae whois.aeda.net.ae

aero whois.aero

af whois.nic.af

ag whois.nic.ag

al whois.ripe.net

am whois.amnic.net

as whois.nic.as

asia whois.nic.asia

at whois.nic.at

au whois.aunic.net

az whois.ripe.net

ba whois.ripe.net

be whois.dns.be

bg whois.register.bg

bi whois.nic.bi

biz whois.neulevel.biz

bj www.nic.bj

br whois.nic.br

bt whois.netnames.net

by whois.ripe.net

bz whois.belizenic.bz

ca whois.cira.ca

cat whois.cat

cc whois.nic.cc

cd whois.nic.cd

ch whois.nic.ch

ck whois.nic.ck

cl nic.cl

cn whois.cnnic.net.cn

co whois.nic.co

co.nl whois.co.nl

com whois.verisign-grs.com

coop whois.nic.coop

cx whois.nic.cx

cy whois.ripe.net

cz whois.nic.cz

de whois.denic.de

dk whois.dk-hostmaster.dk

dm whois.nic.cx

dz whois.nic.dz

edu whois.educause.net

ee whois.tld.ee

eg whois.ripe.net

es whois.ripe.net

eu whois.eu

fi whois.ficora.fi

fo whois.nic.fo

fr whois.nic.fr

gb whois.ripe.net

ge whois.ripe.net

gl whois.nic.gl

gm whois.ripe.net

gov whois.nic.gov

gr whois.ripe.net

gs whois.nic.gs

hk whois.hknic.net.hk

hm whois.registry.hm

hn whois2.afilias-grs.net

hr whois.ripe.net

hu whois.nic.hu

ie whois.domainregistry.ie

il whois.isoc.org.il

in whois.inregistry.net

info whois.afilias.info

int whois.isi.edu

iq vrx.net

ir whois.nic.ir

is whois.isnic.is

it whois.nic.it

je whois.je

jobs jobswhois.verisign-grs.com

jp whois.jprs.jp

kg whois.domain.kg

kr whois.nic.or.kr

la whois2.afilias-grs.net

li whois.nic.li

lt whois.domreg.lt

lu whois.restena.lu

lv whois.nic.lv

ly whois.lydomains.com

ma whois.iam.net.ma

mc whois.ripe.net

md whois.nic.md

me whois.nic.me

mil whois.nic.mil

mk whois.ripe.net

mobi whois.dotmobiregistry.net

ms whois.nic.ms

mt whois.ripe.net

mu whois.nic.mu

mx whois.nic.mx

my whois.mynic.net.my

name whois.nic.name

net whois.verisign-grs.com

nf whois.nic.cx

ng whois.nic.net.ng

nl whois.domain-registry.nl

no whois.norid.no

nu whois.nic.nu

nz whois.srs.net.nz

org whois.pir.org

pl whois.dns.pl

pr whois.nic.pr

pro whois.registrypro.pro

pt whois.dns.pt

ro whois.rotld.ro

ru whois.ripn.ru

sa saudinic.net.sa

sb whois.nic.net.sb

sc whois2.afilias-grs.net

se whois.nic-se.se

sg whois.nic.net.sg

sh whois.nic.sh

si whois.arnes.si

sk whois.sk-nic.sk

sm whois.nic.sm

st whois.nic.st

su whois.ripn.net

tc whois.adamsnames.tc

tel whois.nic.tel

tf whois.nic.tf

th whois.thnic.net

tj whois.nic.tj

tk whois.nic.tk

tl whois.domains.tl

tm whois.nic.tm

tn whois.ripe.net

to whois.tonic.to

tp whois.domains.tl

tr whois.nic.tr

travel whois.nic.travel

tw whois.twnic.net.tw

tv whois.nic.tv

tz whois.tznic.or.tz

ua whois.ua

uk whois.nic.uk

gov.uk whois.ja.net

us whois.nic.us

uy nic.uy

uz whois.cctld.uz

va whois.ripe.net

vc whois2.afilias-grs.net

ve whois.nic.ve

vg whois.adamsnames.tc

ws www.nic.ws

xxx whois.nic.xxx

yu whois.ripe.net

  • 0

Something like below... I don't have a domain I know is pending delete to test this on, but whatever it comes up with in the whois record should be where I've put 'pendingDelete' :)

if(strpos($output, 'No match for domain') !== FALSE)
  mysql_query("INSERT INTO `domains` VALUES ('$i', '$len', 1, '0000-00-00', NULL);") or die($i . ' - ' .mysql_error());
elseif(strpos($output, 'pendingDelete') !== FALSE)
  mysql_query("INSERT INTO `domains` VALUES ('$i', '$len', 2, '$expires', NULL);") or die($i . ' - ' .mysql_error());
else
{
  preg_match('/Expiration Date: (.+?)\n/', $output, $expires);
  $expires = strtotime($expires[1]);
  $expires = date('Y-m-d', $expires);
  mysql_query("INSERT INTO `domains` VALUES ('$i', '$len', 0, '$expires', NULL);") or die($i . ' - ' .mysql_error());
}

  • 0

Hi Alex,

How can I modify the script to search just for the domains with PendingDelete value? I mean to not search for all domains from "a" to "aaa..." but just for all the domains in the registrar database that have the Pending Delete value.

It is consuming too many resurces to go thru all the domain letter combinations. Can the script identify directly just the PendingDelete domains?

Thanks,

Dan

This topic is now closed to further replies.
  • Posts

    • Apple has clarified Series 9 was left off the watchOS 27 compatibility list by mistake.
    • Signal accuses UK government of using child safety as cover for mass surveillance by David Uzondu Recently, the UK's Home Office announced a sweeping set of proposals to make Britain the "first country in the world" where children cannot share or view nude photos on their smart devices, an initiative that authorities claim will protect children from online predators and combat pornography. In response, Signal believes that while the government must keep children "safe" and "protected," it should do so through social services and education, not by "surveillance, funding cuts, and cover-ups." The company called the plan "dystopian" and warned that it violates everyone's fundamental right to privacy, arguing that scanning on the presumption of nudity will only strengthen the market dominance and data control of giant corporations like Apple and Google. The statement continues by accusing the government of hiding its true intentions under the guise of child safety. Signal argues that the Home Office is building an invisible surveillance infrastructure that remains ripe for exploitation by future administrations and authoritarian regimes. According to the company, this aggressive approach completely ignores the actual needs of young people, such as properly funded schools and mental health services. Tech companies like Apple and Google have a three-month window to implement these mandatory device-level filters across the United Kingdom. If these tech firms refuse to comply with the mandate, the government will pass emergency legislation to force them to comply, threatening massive fines and even going after the CEOs of these companies with criminal charges. The technology will work by blocking explicit images directly on the operating system of all smartphones and tablets by default. This system monitors the device camera and third-party apps to intercept nudity before anyone can upload or send the image. Adults can still view explicit content, but only after completing a strict age verification check to unlock their devices. Several bodies like the NSPCC and Barnardo's praised the Home Office's decision, arguing that device-level intervention stops the cycle of grooming before it starts. The Internet Watch Foundation (IWF) also supported the policy, claiming that tech companies can implement on-device checks "without threatening privacy or collecting any data."
    • Did you watch the keynote? It is way beyond what is described in this article. Looks interesting. Now it is time for them to deliver unlike what happened in 24.
    • It pretty much has to be compatible with MS Office or it is going nowhere. The rest of the world runs office including Europe. If it is not compatible it will not survive.
    • Incredible deal gets you free NVMe 512GB SSD with AMD AM5 B850 motherboard for only $150 by Sayan Sen Earlier this week we covered the story of an interesting PC case wherein you can build two full-size computers inside it as in it can house and run an AMD and an Intel system simultaneously. Speaking of building PCs, these are hard times to make one for sure as prices are often very high except during flash sales or discounts. If you are in the market for a 1080p gaming PC then Nvidia's 8GB RTX 5060 Ti is currently on sale for just $330 and you get the latest James Bond game too, for free. Speaking of which, right now there is another incredible sale going on as we can get a free 512 GB NVMe SSD from TeamGroup in the form of the G50 alongside the purchase of an AMD B850 socket AM5 motherboard for only $150 (purchase link under the specs table down below). Getting an AM5 motherboard now in 2026 will be a wise investment for sure, especially since AMD confirmed its commitment to support the socket till at least 2029. The MSI PRO B850M-P WIFI is a micro-ATX motherboard that is compatible with AMD Ryzen 9000 series processors. Since it is AM5, the motherboard works with DDR5 memory and includes MSI’s Memory Boost technology, along with EXPO and XMP support. Connectivity features include built-in Wi-Fi 7 paired with a 5G LAN solution. The board offers a PCIe 5.0 M.2 slot with MSI’s EZ M.2 Shield Frozr II thermal solution, that is said to help maintain SSD performance by providing ample cooling against overheating. The technical specifications of the MSI PRO B850M-P WIFI motherboard are given in the table below: Specification Value Form Factor Micro-ATX (mATX), 243.84 × 243.84 mm Chipset AMD B850 Socket AM5 Supported Processors AMD Ryzen 9000, 8000, and 7000 Series Desktop Processors Memory Slots 4 × DDR5 UDIMM Max Memory 256 GB Memory Speed DDR5 8200–5600 MT/s (OC), DDR5 5600–4800 MT/s (JEDEC) Display Outputs 1 × HDMI 2.1 (up to 4K 60Hz) 1 × DisplayPort 1.4 (up to 4K 60Hz) PCIe Slots 1 × PCIe 5.0 x16 (CPU) 3 × PCIe 3.0 x1 (Chipset) Audio Codec Realtek ALC897 Audio Channels 7.1-Channel High Definition Audio M.2 Slots 3 × M.2 slots M.2_1: PCIe 5.0 x4 (CPU) M.2_2: PCIe 4.0 x4 (CPU) M.2_3: PCIe 4.0 x2 (Chipset) M.2 Device Sizes M.2_1: 2280/2260 M.2_2: 2280/2260 M.2_3: 2280 SATA Ports 4 × SATA 6Gb/s RAID Support SATA: RAID 0, 1, 10 NVMe: RAID 0, 1, 5, 10 Rear USB Ports 4 × USB 2.0 2 × USB 5Gbps Type-A 1 × USB 10Gbps Type-A 1 × USB 10Gbps Type-C Front USB Headers 4 × USB 2.0 4 × USB 5Gbps Type-A 1 × USB 10Gbps Type-C LAN Realtek 8126VB 5Gb Ethernet Wireless Networking Wi-Fi 7 (802.11 a/b/g/n/ac/ax/be) Tri-band 2.4GHz / 5GHz / 6GHz MU-MIMO, MLO, 4KQAM Up to 2.9Gbps Bluetooth Bluetooth 5.4 Internal Power Connectors 1 × 24-pin ATX Power 1 × CPU Power 1 × PCIe Power (8-pin) Cooling Headers 1 × CPU Fan 1 × Combo Fan/Pump 3 × System Fan RGB Headers 3 × Addressable RGB Gen2 (JARGB_V2) 1 × RGB LED (JRGB) Additional Internal Headers 2 × Front Panel (JFP) 1 × Chassis Intrusion (JCI) 1 × Front Audio (JAUD) 1 × COM Port (JCOM) 1 × JDASH Tuning Controller 1 × TPM 2.0 Header The free TeamGroup T-FORCE G50 NVMe SSD is a PCIe Gen4 and as such it promises to deliver sequential read speeds of up to 5,000 MB/s, helping accelerate game loading, file transfers, and everyday computing tasks. The SSD features an InnoGrit controller and SLC caching technology to support consistent performance. An ultra-thin, patented graphene heatsink is included to aid in heat dissipation. The NAND flash is based on TLC which means it has plenty of endurance up its sleeve. The random performance may not be as amazing as other drives with DRAM though. Still it should be very good since it can access system memory via HMB to use it as its DRAM cache. The technical specifications of the TeamGroup 512GB G50 NVMe SSD are given in the table below: Specification Value Model / Part Number TM8FFE512G0C129 Form Factor M.2 2280 Interface PCIe Gen4x4 with NVMe Sequential Read Speed Up to 5,000 MB/s Sequential Write Speed Up to 2,500 MB/s Endurance (TBW) 325 TBW DRAM Cache No Cache Technology SLC Cache Controller InnoGrit Controller Solution Operating Temperature 0°C to 70°C Storage Temperature -40°C to 85°C Weight 7 g Dimensions 80.0 × 22.0 × 3.7 mm Vibration Resistance 80 Hz ~ 2,000 Hz / 20G Shock Resistance 1,500G / 0.5 ms MTBF 3,000,000 hours Get it at the link below: MSI PRO B850M-P WIFI AM5 AMD motherboard + Team Group T-FORCE G50 TM8FFE512G0C129 512GB SSD (free gift): $149.99 (Sold and Shipped by Newegg US) This Newegg deal is US-specific and not available in other regions unless specified. This is a first-party seller link (at the time of article publishing); ensure that you also purchase from a first-party seller link only. If you don't like it or want to look at more options, check out the previous deals that we have covered, OR you can also visit Amazon US deals page. Get Prime (SNAP), Prime Video, Audible Plus or Kindle / Music Unlimited. Free for 30 days. As an Amazon Associate, we earn from qualifying purchases.
  • Recent Achievements

    • Very Popular
      Captain_Eric earned a badge
      Very Popular
    • One Month Later
      amusc earned a badge
      One Month Later
    • One Month Later
      DJC50PLUS earned a badge
      One Month Later
    • Week One Done
      DJC50PLUS earned a badge
      Week One Done
    • Proficient
      Eric Biran went up a rank
      Proficient
  • Popular Contributors

    1. 1
      +primortal
      503
    2. 2
      PsYcHoKiLLa
      223
    3. 3
      ATLien_0
      87
    4. 4
      Steven P.
      80
    5. 5
      +Edouard
      80
  • Tell a friend

    Love Neowin? Tell a friend!