Small bug in php domain scanner.

SpaceshipSpaceship
Spacemail by SpaceshipSpacemail by Spaceship
Namecheap AuctionsNamecheap Auctions
Watch

Barrucadu

Established Member
Impact
64
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:
<?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))];
			}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(); 
	} 

	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>';
?>
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Filters for activity feeds
Your news feed, Latest activity, and the activity tab on profiles now have filter buttons: All, Posts, Quick replies, and Other. Your...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back