php扫描端口

php实现对指定IP进行端口扫描

代码为

IP port  Scan

please enter the IP address

$ip=@$_POST['ip'];

$port=array(21,80,135,443,445,3306,3389,39000);

$time=4;

exec("ping $ip -n $time",$info);

//执行ping命令

if(count($info)>10){

foreach($port as $key=>$value){

$fp=@fsockopen($ip,$value,$errno,$errstr,30);

//打开一个网络连接

    $result=$fp?'open':'close';

echo "

";

echo "

portstatue ".$value."".$result."
";

}

}else{

echo implode("
",$info);

}

?>


php扫描端口_第1张图片

你可能感兴趣的:(php扫描端口)