<?php
print("
[+]程序開始-----------------------------[+]
[-]Explain:完成後自動關閉 打開url.txt查看結果[-]\r\n");
include('url.php');
error_reporting(E_ERROR);
set_time_limit(0);
a();
function Server($url){
$array = get_headers($url,1);
if(array_key_exists('Server',$array)){
if(!is_array($array['Server'])){
//$preg = "/nginx/";
$url = "網址: ".$url." 服務器類型: ".$array['Server']."\r\n";
echo $url;
//if(preg_match($preg,$url)){
// echo $url;
w($url);
//}
}
}
}
function a(){
$url_list =file('list_url.txt');
//print_r($url_list);
foreach ($url_list as $url){
Server(trim($url));
}
}
function w($url){
$fileName = 'url.txt';
$handle = fopen($fileName,'a');
fwrite($handle,$url."\r\n");
}
?>
url.php
<?php
error_reporting(E_ERROR);
set_time_limit(0);
print("開始\r\n");
f();
//獲取url函數
function pregUrl($ip){
$url = @file_get_contents($ip);
//$url_list = file('data.txt');
$preg='/[a-zA-z]+:\/\/[0-9a-zA-z_]?\.[0-9a-zA-z_]+[\.a-z]+/';
if(preg_match_all($preg,$url,$match_all)){
foreach ($match_all as $value){
$value=array_values(array_unique($value));
foreach ($value as $key=>$ok){
$ok=trim($ok);
print("獲取網站{$ok}\r\n");
write($ok);
}
// pregUrl($ok);
}
}
}
//寫入函數
function write($data){
$fileName='t00ls.txt';
$handle = @fopen($fileName,"a");
@fwrite($handle,$data."\r\n");
@fclose($handle);
}
//開始函數
function f(){
$file = file('list_url.txt');
foreach ($file as $value){
$value = trim($value);
pregUrl($value);
}
}
//去掉重復
print("獲取網站完畢\r\n");
unique();
function unique(){
$list_url = file('t00ls.txt');
$filename = 'list_url.txt';
$handle = fopen($filename, 'w');
$list_url = array_unique($list_url);
foreach($list_url as $data){
print("正在寫入網站 ".$data);
fwrite($handle,$data);
}
}
?>