Home >Backend Development >PHP Tutorial >Script to detect NGNIX version_PHP tutorial

Script to detect NGNIX version_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:47:40764browse

print("

[+]Program starts--------------------------------[+]

[-]Explain: Automatically close after completion. Open url.txt to view the results [-]rn");

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: ".$url." Server type: ".$array['Server']."rn";

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."rn");

}

?>

url.php

error_reporting(E_ERROR);

set_time_limit(0);

print("Start rn");

f();

//Get url function

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("Get website{$ok}rn");

write($ok);

 

}

// pregUrl($ok);

}

}

}

//Write function

function write($data){

$fileName='t00ls.txt';

$handle = @fopen($fileName,"a");

@fwrite($handle,$data."rn");

@fclose($handle);

}

//Start function

function f(){

$file = file('list_url.txt');

foreach ($file as $value){

$value = trim($value);

pregUrl($value);

}

}

//Remove duplicates

print("Acquisition of website completed rn");

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("Writing to website ".$data);

fwrite($handle,$data);

}

}

?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478492.htmlTechArticle?php print( [+] Program starts --------------- --------------[+] [-]Explain: Automatically close after completion and open url.txt to view the results [-]rn); include(url.php); error_reporting(E_ERROR); set_time...
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