Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(0);
- set_time_limit(0);
- ini_set('memory_limit', '64M');
- echo "
- _____ _ _ _____ _____ _______
- / ___| | | | | / _ \ / ___/|__ __|
- | | _ | |__| | | | | | | |___ | |
- | | | | | __ | | | | | \___ \ | |
- | |_| | | | | | | |_| | ___| | | |
- \_____/ |_| |_| \_____/ /_____/ |_|
- ____ _ _____ _____ _____ ___ ___
- | _ \ | | / _ \ / _ \ | _ \ \ \ / /
- | |_) | | | | | | | | | | | | | | \ \ \/ /
- | _ ( | | | | | | | | | | | | | | \ /
- | |_) | | |___ | |_| | | |_| | | |_| / | |
- |____/ |_____| \_____/ \_____/ |_____/ |__|
- [*]-----------------------------------------------------------------------[*]
- [+] Script Name : Reverse IP
- [+] Version : 1.0
- [+] Programed By : G-B
- [+] Email : g22b@hotmail.com
- [+] Use : php $_SERVER[PHP_SELF]
- [*]-----------------------------------------------------------------------[*]
- ";
- $a = true;
- $chs = array('0','1');
- while($a){
- echo "[*]---------------------------Options-------------------------------------[*]\n [0] - Single IP\n [1] - Range\n[*]-----------------------------------------------------------------------[*]\n\n[+] Select An Option -> ";
- $b = true;
- while($b){
- $ch = trim(fgets(STDIN,1024));
- if(in_array($ch,$chs)){
- $b = false;
- }else{
- echo "\n[~] Error Try Again.\n\n";
- }
- }
- echo "\n";
- switch($ch){
- case '0':
- ipreverse();
- break;
- case '1':
- rangescan();
- break;
- }
- echo "\n\n[+] Scan Again ? (Y,N) -> ";
- $yn = strtolower(trim(fgets(STDIN,1024)));
- if($yn!='y'){
- echo "\n[*] See U Later, G-B.";
- $a = false;
- }
- }
- function src($url,$post=false){
- $ch = curl_init();
- curl_setopt($ch,CURLOPT_URL,$url);
- curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);
- curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
- curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE);
- curl_setopt($ch,CURLOPT_FOLLOWLOCATION,true);
- curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20100101 Firefox/21.0');
- if($post){
- curl_setopt($ch,CURLOPT_POST,true);
- curl_setopt($ch,CURLOPT_POSTFIELDS,$post);
- }
- $s = curl_exec($ch);
- curl_close($ch);
- return $s;
- }
- function getdomains($ip,$host=false){
- $domains = array();
- $targets[] = array('url'=>'http://domains.yougetsignal.com/domains.php','post'=>array('remoteAddress'=>$ip,'key'=>''),'json'=>'domainArray','spe'=>true);
- $targets[] = array('url'=>'http://www.my-ip-neighbors.com/?domain='.$ip,'reg'=>'/<td class="domain" >(.*?)<\/td>/','post'=>false,'spe'=>false);
- $targets[] = array('url'=>'http://sameip.org/ip/'.$ip,'reg'=>'/target="_blank">(.*?) whois<\/a>/','post'=>false,'spe'=>false);
- $targets[] = array('url'=>'http://whois.webhosting.info/'.$ip,'reg'=>'/<a href="http:\/\/whois.webhosting.info\/(.*?).">(.*?)\.<\/a>/','post'=>false,'spe'=>false);
- $targets[] = array('url'=>"http://www.pagesinventory.com/ip/$ip.html",'reg'=>'/<a href="\/domain\/(.*?).html">(.*?)<\/a>/','post'=>false,'spe'=>false);
- $targets[] = array('url'=>'http://www.ip-adress.com/reverse_ip/'.$ip,'reg'=>'/\[<a href="\/whois\/(.*?)">Whois<\/a>\]/','post'=>false,'spe'=>false);
- foreach($targets as $target){
- $src = src($target['url'],$target['post']);
- if(!isset($target['json'])){
- preg_match_all($target['reg'],$src,$infos);
- $info = $infos[1];
- }else{
- $infos = json_decode($src);
- $info = $infos->{$target['json']};
- }
- if($target['spe']){
- $infos = $info;
- $info = array();
- if($infos){
- foreach($infos as $tt){
- $info[] = $tt[0];
- }
- }
- }
- if(count($info) == 0) continue;
- foreach($info as $domain){
- if(!filter_var("http://$domain",FILTER_VALIDATE_URL)) continue;
- $domain = strtolower($domain);
- $domain = str_replace('www.','',$domain);
- if($host AND $domain==$host) continue;
- if(in_array($domain,$domains)) continue;
- $domains[] = $domain;
- }
- }
- return $domains;
- }
- function genips($from,$to){
- $from = ip2long($from);
- $to = ip2long($to);
- for($from;$from<=$to;$from++){
- echo long2ip($from).'<br />';
- }
- }
- function test($ip){
- $fp = fsockopen($ip,80,$errno,$errstr,2);
- if($fp){
- fclose($fp);
- return true;
- }else{
- return false;
- }
- }
- function save($file,$line){
- if(!file_exists($file)){
- file_put_contents($file,"
- _____ _ _ _____ _____ _______
- / ___| | | | | / _ \ / ___/|__ __|
- | | _ | |__| | | | | | | |___ | |
- | | | | | __ | | | | | \___ \ | |
- | |_| | | | | | | |_| | ___| | | |
- \_____/ |_| |_| \_____/ /_____/ |_|
- ____ _ _____ _____ _____ ___ ___
- | _ \ | | / _ \ / _ \ | _ \ \ \ / /
- | |_) | | | | | | | | | | | | | | \ \ \/ /
- | _ ( | | | | | | | | | | | | | | \ /
- | |_) | | |___ | |_| | | |_| | | |_| / | |
- |____/ |_____| \_____/ \_____/ |_____/ |__|\n\n");
- }
- $fp = fopen($file,'a');
- fwrite($fp,$line);
- fclose($fp);
- }
- function rangescan(){
- $a = true;
- while($a){
- $b = true;
- while($b){
- echo "[+] From -> ";
- $from = trim(fgets(STDIN,1024));
- if(filter_var($from,FILTER_VALIDATE_IP)){
- $b = false;
- }else{
- echo "[~] Invalid IP Try Again.\n";
- }
- }
- $b = true;
- while($b){
- echo "[+] To -> ";
- $to = trim(fgets(STDIN,1024));
- if(filter_var($to,FILTER_VALIDATE_IP)){
- $b = false;
- }else{
- echo "\n[~] Invalid IP Try Again.\n\n";
- }
- }
- $from = ip2long($from);
- $to = ip2long($to);
- if($from>$to){
- echo "\n[~] Invalid Range Try Again.\n\n";
- }else{
- $a = false;
- }
- }
- echo "\n\n";
- $file = long2ip($from)."-".long2ip($to).".txt";
- save($file,"\n+------------------------Range----------------------------------+\n\n");
- $line = "+---------------------------------------------------------------+\n";
- $line .= "| IP | Hostname | Domains |\n";
- $line .= "+---------------------------------------------------------------+\n";
- echo $line;
- save($file,$line);
- $rdomains = array();
- for($from;$from<=$to;$from++){
- $ip = long2ip($from);
- $line = '';
- if(@test($ip)){
- $fulline = '';
- $line = "| ".$ip.str_repeat(" ",17-strlen($ip))."|";
- save($file,$line);
- echo $line;
- $host = strtolower(gethostbyaddr($ip));
- $line = " ".$host.str_repeat(" ",33-strlen($host))."|";
- save($file,$line);
- echo $line;
- $domains = getdomains($ip,$host);
- $domainsc = count($domains);
- $line = " ".$domainsc.str_repeat(" ",8-strlen($domainsc))."|";
- save($file,$line);
- echo $line;
- $line = "\n+---------------------------------------------------------------+\n";
- save($file,$line);
- echo $line;
- if($domainsc > 0){
- $rdomains[$ip] = array();
- foreach($domains as $domain){
- if($domain==$host) continue;
- $rdomains[$ip][] = $domain;
- }
- }
- }
- }
- save($file,"\n\n+------------------------Domains--------------------------------+\n");
- foreach($rdomains as $ip=>$domains){
- save($file,"\n[+] $ip : \n\n");
- foreach($domains as $domain){
- save($file," $domain\n");
- }
- }
- }
- function ipreverse(){
- $a = true;
- while($a){
- echo "[+] Server IP -> ";
- $ip = trim(fgets(STDIN,1024));
- if(filter_var($ip,FILTER_VALIDATE_IP)){
- $a = false;
- }else{
- echo "\n[~] Invalid IP Try Again.\n\n";
- }
- }
- $file = "$ip.txt";
- $domains = getdomains($ip);
- if(count($domains)>0){
- $line = "\n+------------------------Domains--------------------------------+\n\n";
- save($file,$line);
- echo $line;
- foreach($domains as $domain){
- echo "$domain\n";
- save($file,"$domain\n");
- }
- }
- echo "\n[*] ".count($domains)." Domains Founded.\n";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement