NameSilo

Polite Mass-"Scriptable"-Domainer

SpaceshipSpaceship
SpaceshipSpaceship
SpaceshipSpaceship
Watch

Refrozen

Account Closed
Impact
9
PHP script meant to be run on the CLI; currently only works on *NIX based systems, or systems with the "WHOIS" application. :)

Politely waits 5 seconds between iterations - is this enough? should it be more? I'm not familiar with robot-netiquette.

Code:
#! /usr/bin/php
<?php
        $disableSleepOutput = true;
        $debug = false;

        $pattern = $argv[1];
        $end = 'z';
        for($i='a';$i<'z';$i++) {
                debugPrint("New \$i Iteration: $i\n");
                for($b='a';$b<'z';$b++) {
                        debugPrint("New \$b Iteration: $b\n");
                        $test = str_replace("*", $i, $pattern);
                        $test = str_replace("%", $b, $test);

                        echo "Checking $test: ";
                        echo checkWhois($test) ? "Available." : "Registered.";
                        echo "\n";

                        sleepSmart(5);

                        if(!stristr($pattern, "%")) $b='y';     // HACK HACK HACK, this entire nested $i, $b crap is a hack
                }
        }





function debugPrint($z) {
        global $debug;
        if($debug) print $z;
}



function sleepSmart($seconds) {
        global $disableSleepOutput;
        if($disableSleepOutput) { sleep($seconds); } else {
                echo "Sleeping for $seconds seconds: ";
                for($i=1;$i<=$seconds;$i++) {
                        echo $i . "... ";
                        sleep(1);
                }
                echo "\n";
        }
}

function checkWhois($domain) {
        ob_start();
                system("whois " . $domain);
                $cntns = ob_get_contents();
        ob_end_clean();

        if((stristr($cntns, "no match") || stristr($cntns,"not found")) && !stristr($cntns, "Name Server: ns"))
                return true;
        else
                return false;
}

?>



It's currently a bit of a hack, REP++ to anyone who cleans it up or adds functionality.

Aha! So I found my old code for this, so I quickly hacked up version two

Code:
#! /usr/bin/php
<?

        $disableSleepOutput = true;

        $vowelArray = array('a','e','i','o','u');

        $base = $argv[1];

        if($base == "help") { echo "base start end [v|d]\n v = vowels only, d = debug mode"; }
        if($base == "debug") { print_r($argv); print_r($vowelArray); }
        $start = $argv[2];
        $end = $argv[3];
        $arg = '';
        $arg = @$argv[4];

        if($arg == "v") {
                $start=0;
                $end=count($vowelArray);
        }

        for($i=$start;$i<$end;$i++) {
                if($arg == 'd') { echo $i . " of " . $end . "\n"; }
                $use = $i;
                if($arg=="v") {
                        $use = $vowelArray[$i];
                }
                $query = str_replace("*", $use, $base);
                echo "$query: ";
                echo checkWhois($query) ? "Available   " : "Registered   ";
                echo "\n";
                sleepSmart(5);

        }

function debugPrint($z) {
        global $debug;
        if($debug) print $z;
}



function sleepSmart($seconds) {
        global $disableSleepOutput;
        if($disableSleepOutput) { sleep($seconds); } else {
                echo "Sleeping for $seconds seconds: ";
                for($i=1;$i<=$seconds;$i++) {
                        echo $i . "... ";
                        sleep(1);
                }
                echo "\n";
        }
}

function checkWhois($domain) {
        ob_start();
                system("whois -H -F " . $domain);
                $cntns = ob_get_contents();
        ob_end_clean();

        if((stristr($cntns, "no match") || stristr($cntns,"not found")) && !stristr($cntns, "Name Server: ns"))
                return true;
        else
                return false;
}

?>

It works a little differently, pass it something like this:

`d**main.com a z`

and it'll loop from a to z and replace ** with those characters.

The WHOIS servers seem to hate this through. :( Any solutions?
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Appraise.net

We're social

Escrow.com
Spaceship
CryptoExchange.com
Domain Recover

NamePros updates

Quick replies: search, your most used replies, and more on every post
Quick replies are easier to find and use now. The quick reply menu has a search box. Type a few letters to find the reply you want. A...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back