Verkauf von Domains leider wenig Erfahrung, ist das von privat überhaupt legal?
<?php
/*
License: http://creativecommons.org/licenses/by-nc-sa/3.0/ (Noncommercial, Share-Alike)
Author: Daniel Ruppert
Version: 1.0
[INFO]
This requires
- shell access (don't run it in your browser)
- 'dig' preinstalled
- "shell_exec" enabled
- no time limit
[Notice]
Don't change the hardcoded default values but overwrite them after having loaded the class!
*/
class scanner {
var $extension = 'de';
var $dns_server = array('a.nic.de.','s.de.net.','z.nic.de.');
var $length = 2;
var $counts;
var $letters = 'abcdefghijklmnopqrstuvwxyz0123456789';
var $status = array('show'=>true);
var $starttime;
var $use_internal_dns = false; //enable this if your resolver rate-limits DNS requests
function scanRange() {
for($i=1;$i<=$this->length;$i++) $this->counts[$i] = 1;
$this->counts[count($this->counts)] = 0;
if($this->status['show']) {
$this->status['possibilities'] = pow(strlen($this->letters),$this->length);
$this->status['curr'] = 0;
$this->starttime = time();
}
while(true) {
$this->status['curr']++;
if($this->status['show']) $this->Info();
$chars = $this->generateNext();
if($chars === true) die(PHP_EOL."done");
$domain = $chars.'.de';
//echo PHP_EOL.$chars;
if($this->checkFree($domain)) echo PHP_EOL.$domain.PHP_EOL.PHP_EOL;
}
}
function generateNext() {
$letters_count = strlen($this->letters);
$this->counts[$this->length]++;
for($i=$this->length;$i>0;$i--) {
if($this->counts[$i] > $letters_count) {
$this->counts[$i] = 1;
if(($i-1) == 0) return true; //first char
else $this->counts[$i-1]++;
}
}
$str = '';
for($i=1;$i<=$this->length;$i++) {
$str .= $this->letters[$this->counts[$i]-1];
}
return $str;
}
function checkFree($domain) {
if($this->use_internal_dns) $records = dns_get_record($domain,DNS_NS);
else $records = array();
if(!count($records) && $this->deepCheckFree($domain)) return true;
else return false;
}
function deepCheckFree($domain) {
$result = shell_exec("dig @".$this->dns_server[array_rand($this->dns_server)]." DNS_NX ".$domain);
if(strpos($result,"NXDOMAIN") !== false) return true;
else return false;
}
function Info() {
$percent = floor($this->status['curr']/$this->status['possibilities']*100);
$elapsed = $this->elapsedTime(time()-$this->starttime);
echo "\r".$percent." % complete || ".$this->status['curr']." / ".$this->status['possibilities']." || Time elapsed: ".$elapsed['days']." days, ".$elapsed['hours']." hours, ".$elapsed['minutes']." minutes, ".$elapsed['seconds']." seconds";
}
function elapsedTime($time) {
$array = array();
$uses = array('days'=>86400,'hours'=>3600,'minutes'=>60,'seconds'=>1);
foreach($uses as $key=>$use) {
$array[$key] = 0;
if($time > $use) {
$multiple = floor($time/$use);
$time = $time - $multiple*$use;
$array[$key] = $multiple;
}
}
return $array;
}
}
$scan = new scanner;
$scan->length = 3; //superseed the default length
$scan->scanRange();
?>
We use essential cookies to make this site work, and optional cookies to enhance your experience.