Skip to content

Instantly share code, notes, and snippets.

@Eckankar
Created January 10, 2011 19:06
Show Gist options
  • Save Eckankar/773268 to your computer and use it in GitHub Desktop.
Save Eckankar/773268 to your computer and use it in GitHub Desktop.
Scans for 3-letter domains
<?php
///////////////////////////////////////////////////////////////////////////////
//
// Scans for 3-letter domain names.
//
///////////////////////////////////////////////////////////////////////////////
// This is the number of domains the script will stop at.
$i = 100;
ob_start();
function checkdomain($xserver, $xdomain) {
$sock = fsockopen($xserver,43) or die("Error Connecting To Whois Server");
fputs($sock,"$xdomain\r\n");
$result = '';
while(!feof($sock))
$result .= fgets($sock,128);
fclose($sock);
return (strpos($result, "No match") !== FALSE ||
strpos($result, "no matches") !== FALSE ||
strpos($result, "NO MATCH") !== FALSE ||
strpos($result, "not found") !== FALSE ||
strpos($result, "Not found") !== FALSE ||
strpos($result, "NOT FOUND") !== FALSE ||
strpos($result, "Status: FREE") !== FALSE ||
strpos($result, "Status: free") != FALSE ||
strpos($result, "No entries found") != FALSE);
}
Header("Content-Type: text/plain");
$chars = str_split("abcdefghijklmnopqrstuvwxyz");
$registrars = array(
//"com" => "whois.nsiregistry.net",
//"net" => "whois.nsiregistry.net",
//"org" => "whois.pir.org",
//"info" => "whois.afilias.net",
//"biz" => "whois.biz",
//"us" => "whois.nic.us",
//"nu" => "whois.nic.nu",
"se" => "whois.iis.se",
"no" => "whois.norid.no",
"dk" => "whois.dk-hostmaster.dk",
//"be" => "whois.dns.be",
//"de" => "whois.denic.de",
);
set_time_limit(30);
while($i > 0){
$current = $chars[array_rand($chars)].
$chars[array_rand($chars)].
$chars[array_rand($chars)];
$found = false;
foreach ($registrars as $tld => $server) {
if (checkdomain($server,"$current.$tld")) {
$found = true;
echo "$current.$tld\n";
$i-=1;
}
}
if ($found)
echo "\n";
ob_flush();
flush();
}
echo "\nDone.\n";
ob_flush();
flush();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment