Php做的端口嗅探器--可以指定网站和端口_php基础
程序员文章站
2022-04-10 09:22:59
...
//Php做的端口嗅探器--可以指定网站和端口
//并返回嗅探结果
function http_request($server, $port) {
$data = "";
$query = "HEAD / HTTP/1.0";
$fp = fsockopen($server, $port);
if($fp) {
fputs($fp, $query."rnn");
while(!feof($fp)) {
$data .= fread($fp, 1000);
}
fclose($fp);
}
return $data;
}
?>
if($action == "query") {
$data = http_request($server, $port);
echo "Connected To $server on port $port.
//并返回嗅探结果
function http_request($server, $port) {
$data = "";
$query = "HEAD / HTTP/1.0";
$fp = fsockopen($server, $port);
if($fp) {
fputs($fp, $query."rnn");
while(!feof($fp)) {
$data .= fread($fp, 1000);
}
fclose($fp);
}
return $data;
}
?>
if($action == "query") {
$data = http_request($server, $port);
echo "Connected To $server on port $port.
";
echo "Output:
$data
";
}
?>
上一篇: Group by字句的用法