记住用户名密码
php实现对指定IP进行端口扫描
代码为
<html> <head> <meta http-equiv="Content-Type" content="text-html; charset=utf-8" /> <title>IP port Scan</title> <style type="text/css"> td{ padding:10px; margin: 10px; border-width:1px solid #eee; text-align: center; } span{ color: red; } </style> </head> <body> <form action="" method="POST"> please enter the IP address <input type="text" name="ip" > <input type="submit" value="submit" style="display:none"> </form> <?php $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?'<span>open<span>':'close'; echo "<table><tr><td>port</td><td>statue</td>"; echo "<td>".$value."<td/><td>".$result."<td/></tr></table>"; } }else{ echo implode("<br/>",$info); } ?> </body> </html>
目前有 0 条留言 其中:访客:0 条, 博主:0 条