mikeyy_
Junior Member
- Oct 17, 2009
- 109
- 71
Hey guys,
Got really bored today and decided to code a domain scanner. If you are familiar with SEO, then you will know that 3 character domains are very rare, can have a ton of traffic, are easiest to remember and access.
This script will scan for random 3-4 character domains and will save them to a text file when found. You can edit it as you like to scan for certain domains or etc. If you want to allow certain characters, find this line..
Got really bored today and decided to code a domain scanner. If you are familiar with SEO, then you will know that 3 character domains are very rare, can have a ton of traffic, are easiest to remember and access.
This script will scan for random 3-4 character domains and will save them to a text file when found. You can edit it as you like to scan for certain domains or etc. If you want to allow certain characters, find this line..
PHP:
function get_rand_id($length)
{
if($length>0)
{
$rand_id="";
for($i=1; $i<=$length; $i++)
{
mt_srand((double)microtime() * 1000000);
$num = mt_rand(1,36); // all characters
//$num = mt_rand(26,36); only numbers
//$num = mt_rand(1,26); only alphas
$rand_id .= assign_rand_value($num);
}
}
return $rand_id;
}
PHP:
<?php
$save = "domains.txt"; //where to save domains found
$amount = 100000; //amount of domains to scan for
for($i=0;$i < $amount;$i++){
//you can edit this to scan for how many char the domain should have
/* ex.
$name = get_rand_id(3); scans for 3 char domains
$name = get_rand_id(4); scans for 4 char domains
if you want to scan for more, then do this
$ranlim = rand(3,5);
if($ranlim == 3){
$name = get_rand_id(3);
}elseif($ranlim == 4){
$name = get_rand_id(4);
}elseif($ranlim == 5){
$name = get_rand_id(5);
}
*/
$ranlim = rand(3,4);
if($ranlim == 3){
$name = get_rand_id(3);
}elseif($ranlim == 4){
$name = get_rand_id(4);
}
echo "Name: ".$name."\n";
$content = getQuery($name);
//echo $content;
preg_match('#com: "(.*)", net: "(.*)", org: "(.*)"#', $content, $tld);
$com = $tld[1];
$net = $tld[2];
$org = $tld[3];
if($com == "a"){
echo $name.".com is available.\n\n";
$fh = fopen($save, 'a');
fwrite($fh, $name.".com\n");
fclose($fh);
}elseif($com == "u"){
echo $name.".com is unavailable.\n\n";
}
if($net == "a"){
echo $name.".net is available.\n";
$fh = fopen($save, 'a');
fwrite($fh, $name.".net\n");
fclose($fh);
}elseif($net == "u"){
echo $name.".net is unavailable.\n";
}
if($org == "a"){
echo $name.".org is available.\n\n";
$fh = fopen($save, 'a');
fwrite($fh, $name.".org\n");
fclose($fh);
}elseif($org == "u"){
echo $name.".org is unavailable.\n\n";
}
}
function assign_rand_value($num)
{
switch($num)
{
case "1":
$rand_value = "a";
break;
case "2":
$rand_value = "b";
break;
case "3":
$rand_value = "c";
break;
case "4":
$rand_value = "d";
break;
case "5":
$rand_value = "e";
break;
case "6":
$rand_value = "f";
break;
case "7":
$rand_value = "g";
break;
case "8":
$rand_value = "h";
break;
case "9":
$rand_value = "i";
break;
case "10":
$rand_value = "j";
break;
case "11":
$rand_value = "k";
break;
case "12":
$rand_value = "l";
break;
case "13":
$rand_value = "m";
break;
case "14":
$rand_value = "n";
break;
case "15":
$rand_value = "o";
break;
case "16":
$rand_value = "p";
break;
case "17":
$rand_value = "q";
break;
case "18":
$rand_value = "r";
break;
case "19":
$rand_value = "s";
break;
case "20":
$rand_value = "t";
break;
case "21":
$rand_value = "u";
break;
case "22":
$rand_value = "v";
break;
case "23":
$rand_value = "w";
break;
case "24":
$rand_value = "x";
break;
case "25":
$rand_value = "y";
break;
case "26":
$rand_value = "z";
break;
case "27":
$rand_value = "0";
break;
case "28":
$rand_value = "1";
break;
case "29":
$rand_value = "2";
break;
case "30":
$rand_value = "3";
break;
case "31":
$rand_value = "4";
break;
case "32":
$rand_value = "5";
break;
case "33":
$rand_value = "6";
break;
case "34":
$rand_value = "7";
break;
case "35":
$rand_value = "8";
break;
case "36":
$rand_value = "9";
break;
}
return $rand_value;
}
function get_rand_id($length)
{
if($length>0)
{
$rand_id="";
for($i=1; $i<=$length; $i++)
{
mt_srand((double)microtime() * 1000000);
$num = mt_rand(1,36);
$rand_id .= assign_rand_value($num);
}
}
return $rand_id;
}
function getQuery($name)
{
$fp = fsockopen("www.bustaname.com", 80, $errno, $errstr, 30);
fputs($fp, "GET /quick_check/".urlencode($name)." HTTP/1.1\r\n");
fputs($fp, "Host: www.bustaname.com\r\n");
fputs($fp, "User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.10) Gecko/2009042315 Firefox/3.0.10\r\n");
fputs($fp, "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n");
fputs($fp, "Accept-Language: en-us,en;q=0.5\r\n");
fputs($fp, "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n");
fputs($fp, "Connection: close\r\n\r\n");
while (!feof($fp)) {
$buf .= fgets($fp,128);
}
fclose($fp);
return $buf;
}
?>