欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

检测NGNIX版本的脚本_PHP教程

程序员文章站 2022-05-02 13:16:26
...

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

}

}

?>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/478492.htmlTechArticle?php print( [+]程序开始-----------------------------[+] [-]Explain:完成后自动关闭 打开url.txt查看结果[-]\r\n); include(url.php); error_reporting(E_ERROR); set_time...