本帖最后由 lostwolf 于 2012-7-29 00:29 编辑
适合查询国外站点
特点:
1、查询被和谐的站点不会被重置 (国内很多站 查询都会出现重置)
2、源码开放的 可以任意修改
3、命令行下的很方便 很简洁
4、查询完毕将输出 以查询的网站作为文件名的html文件 可直接点击 也可以直接复制为纯文本
5、采用 必应 以及 sameip 以及另一个十分强悍的接口
6、大家有什么好的接口可加进来
7、查询url的同时输出ip(防止域名过期 或 dns缓存)
<?php
error_reporting(0);
@ini_set('memory_limit','-1');
set_time_limit(0);
function isCli(){
return defined('STDIN');
}
if(!isCli()){
exit("[!] This program must be run in command line mode!");
}
function curl_exists(){
if(!function_exists(curl_init)){
die( " [!] Sorry cURL is not installed!"."\r\n");
}
}
if ($argc<3)
{
logo();
print_r("
GetDomain: missing URL...
Usage: $argv[0] [OPTION]......
$argv[0] -u, --url get the same server domain.\r\n
Example:
$argv[0] --url [url]http://www.baidu.com
");
exit();
}
logo();
switch($argc){
case 3:
if($argv[1]=='--url'||$argv[1]=='-u')
{
$ip=$argv[2];
if(substr($ip,0,7)!='http://')
$ip='http://'.$ip;
$ip=parse_url($ip,PHP_URL_HOST);
$ip=gethostbyname($ip);
$tmp='tmp';
if(file_exists($tmp)){
unlink($tmp);
}
get_url2($ip);
get_url($ip);
get_url3($ip);
$temp=file('tmp');
$temp=str_replace('www.','',$temp);
$temp=array_values(array_unique($temp));
//$temp=implode('',$temp);
//print_r($temp);
$htmlfile=$argv[2].'.html';
if(file_exists($htmlfile)){
unlink($htmlfile);
}
foreach ($temp as $key=>$r){
echo '
'.trim($r).' [IP] => '.gethostbyname(trim($temp[$key]))."\r\n";
}
$str= '<p align="left"><font face="Verdana" size="3">'."\r\n"."Same IPenum V1.0 report"."\r\n</font></p>"."\r\n"."<hr>"."\r\n" ;
foreach($temp as $v){
$str .= '<a href="http://'.trim($v).'"'. "target='_blank'>".$v."</a><br>";
}
fwrite(fopen($htmlfile,'a'),$str);
unlink('tmp');
echo "\r\n\r\n Query success!\r\n";
$files=dirname(__FILE__).DIRECTORY_SEPARATOR.$htmlfile.PHP_EOL;
echo " result save to $files";
}
}
function get_url2($ip){
$url="http://sameip.org/ip/$ip";
$content=file_get_contents($url);
preg_match_all('/(?<=href=")http:\/\/[a-zA-Z0-9._-]*/',$content,$m);
$str=$m[0];
$str = array_slice($str,0,-3);
foreach($str as $urls){
$urls=parse_url($urls,PHP_URL_HOST)."\r\n";
$fp=fopen('tmp','a');
@fwrite($fp,$urls);
@fclose($fp);
}
}
function get_url($ip){
$url = "http://api.bing.net/xml.aspx?AppId=BE2FD6F72FAB50C986F7FCD944E0BEEBCEC3BCD1&Query=ip:$ip&Verstion=2.0&Market=en-US&Sources=web+spell&web.count=50&web.offset=50";
$content = file_get_contents($url);
preg_match_all("/<web:Url>(.*?)<\/web:Url>/",$content,$arr);
foreach ($arr[1] as $url){
$url=parse_url($url,PHP_URL_HOST)."\r\n";
@$fp=@fopen('tmp','a');
@fwrite($fp,$url);
@fclose($fp);
}
}
function get_url3($ip){
$post_url='http://www.yougetsignal.com/tools/web-sites-on-web-server/php/get-web-sites-on-web-server-json-data.php';
$post_data="remoteAddress=$ip&key=";
$datas=post($post_url,$post_data);
preg_match_all('/(?<=\")[\w|.]+\.\w+(?=\")/',$datas,$matches);
$u=$matches[0];
foreach ($u as $v ){
$data= $v."\r\n";
$fp=fopen('tmp','a');
@fwrite($fp,$data);
@fclose($fp);
}
}
function post($url,$data){ // 模拟提交数据函数
$curl = curl_init(); // 启动一个CURL会话
curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1); // 从证书中检查SSL加密算法是否存在
curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER
); // 模拟用户使用的浏览器
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); // 使用自动跳转
curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自动设置Referer
curl_setopt($curl, CURLOPT_POST, 1); // 发送一个常规的Post请求
curl_setopt($curl, CURLOPT_POSTFIELDS, $data); // Post提交的数据包
curl_setopt($curl, CURLOPT_COOKIEFILE, $GLOBALS
); // 读取上面所储存的Cookie信息
curl_setopt($curl, CURLOPT_TIMEOUT, 30); // 设置超时限制防止死循环
curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回
$tmpInfo = curl_exec($curl); // 执行操作
if (curl_errno($curl)) {
echo 'Errno'.curl_error($curl);
}
curl_close($curl); // 关键CURL会话
return $tmpInfo; // 返回数据
}
function logo(){
echo "\r\n\r\n";
print_r(" Same IPenum V1.0 report [ Blog:exploit-db.blogcn.com ]\r\n\r\n");
isCli();
curl_exists();
}
?>