Home >php教程 >php手册 >检测NGNIX版本的脚本

检测NGNIX版本的脚本

WBOY
WBOYOriginal
2016-06-13 10:46:11837browse

 

 

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

 

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);

 

}

}

 

 

 

?>

 

 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn