NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Small bug in php domain scanner.

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 03-06-2007, 11:40 AM THREAD STARTER               #1 (permalink)
Senior Member
 
Barrucadu's Avatar
Join Date: Aug 2005
Location: East Yorkshire, England
Posts: 2,689
Barrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to behold
 




Small bug in php domain scanner.


First of all, this is basicly a modified version of Jim_'s 3-char domain scanner script.

To see the bug, go here: http://mikor.clearlyhosted.org/scan.php and scan for a few hundred domains involving a hyphen (try sCV-VC, there arn't many of them regged).
The problem is, in hyphenated domains, sometimes characters are missed out, and I dont know why.

Here is the full code:

PHP Code:
<?php

$ubound 
$_POST['ubound'];
$i $ubound;
$x 0;
$x2 0;

function 
checkdomain($xserver$xdomain) { 
    
$sock fsockopen($xserver,43) or die("Error Connecting To Whois Server"); 
    
fputs($sock,"$xdomain\r\n"); 
    while(!
feof($sock)){ 
        
$result .= fgets($sock,128); 
    }
    
fclose($sock); 
    if(
eregi("No match",$result)||eregi("NOT FOUND",$result)){
        return 
true
    }else{
        return 
false
    }


$V = array('a','e','i','o','u','y');
$C = array('b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','z');
$N = array('0','1','2','3','4','5','6','7','8','9');

$L $V $C;
$A $L $N;

$dnstyle $_POST['pattern'];

echo 
'<title>Domain Scan</title>
<style>
div{
    font-family:Verdana, Trebuchet MS;
    font-size:1em;
}
h1{
    font-size:5em;
    text-align:center;
}
td{
    vertical-align:top;
}
input{
    font-family:Verdana, Trebuchet MS;
    font-size:0.75em;
}
a:active, a:visited, a:link{
    text-decoration:none;
    color:#99AAFF;
}
a:hover{
    text-decoration:underline;
    color:#FF99AA;
}
</style>
<div>'
;

if(
strlen($dnstyle) != 0){
    echo 
'<h1>'.$dnstyle.'</h1>
    <div align="center">
    <table border="0" cellpadding="10" cellspacing="10" width="100%"><tr><td>'
;

    while(
$i 0){  
        
$i2=0;
        
$current '';
    
        while(
$i2 strlen($dnstyle)){
            if(
$dnstyle[$i2] == 'V'){
                
$current .= $V[rand(0,count($V))];
            }elseif(
$dnstyle[$i2] == 'C'){
                
$current .= $C[rand(0,count($C))];
????: NamePros.com http://www.namepros.com/programming/301869-small-bug-in-php-domain-scanner.html
            }elseif(
$dnstyle[$i2] == 'N'){
                
$current .= $N[rand(0,count($N))];
            }elseif(
$dnstyle[$i2] == 'L'){
                
$current .= $A[rand(0,count($A))];
            }elseif(
$dnstyle[$i2] == 'A'){
                
$current .= $L[rand(0,count($L))];
            }else{
                
$current .= $dnstyle[$i2];
            }
            
$i2++;
        }
    
        
$current strtoupper($current);

        if(
checkdomain("rs.internic.net",$current.".com")){ 
            echo 
"<strong>".(1+$ubound-$i)."]</strong> ".$current.".COM\n<br />";
            
$i--;
            
$x++;
            if(
$x == 10){
                
$x 0;
                
$x2++;
                if(
$x2 != 5){
                    echo 
'</td><td>';
                }else{
                    echo 
'</td>';
                }
            }
            if(
$x2 == 5){
                
$x2 0;
                echo 
'</tr><tr><td>';
            }
        } 

        
ob_flush(); 
        
flush(); 
    } 
????: NamePros.com http://www.namepros.com/showthread.php?t=301869

    echo 
'</td></tr></table><a href="scan.php">Return</a></div>'

}else{
    echo 
'<h1>Domain Scan</h1>
    <div align="center">
    <form action="scan.php" method="post">
    <table border="0" cellpadding="10" cellspacing="10" width="100%">
    <tr><td>Domain Pattern:</td><td><input type="text" name="pattern" /></td></tr>
    <tr><td>Domains to Scan:</td><td><input type="text" name="ubound" value="30" /></td></tr>
    <tr><td colspan="2"><input type="submit" value="Scan" /></td></tr>
    <tr><td colspan="2">
    <strong>V</strong> = Vowel<br/>
    <strong>C</strong> = Consonant<br/>
    <strong>L</strong> = Letter<br/>
    <strong>N</strong> = Number<br/>
    <strong>A</strong> = Random<br/>
    <strong>Anything else will be left as it is in the domain.</strong> (eg: CVC-N)<br/>
    Note: This script counts "Y" as a vowel, not a consonant.
    </td></tr>
    </table></form></div>'
;
}

echo 
'</div>';
?>
Barrucadu is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 06:24 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger