// 用for语句,分别用fsockopen函数连接远程主机的相关端口,并输出结果 echo "<tr><td colspan=4 align=center>/n";
echo "<a href=portscan.php><font color=#FFFFFF>继续扫描>>></font></a></td>/n";
echo "</tr/n";
echo "</table>/n";
echo "<TABLE cellSpacing=0 cellPadding=10 width=100% border=0>/n";
echo "<TR>/n";
echo "<TD align=center><b>Copyright © 2004 Security Angel Team[S4T] All Rights Reserved.</b></TD>/n";
echo "</TR>/n";
echo "</TABLE>/n";
echo "</center>/n";
echo "</body>/n";
echo "</html>/n";
exit;
}
// 探测结束 echo "<table border=0 cellpadding=15 cellspacing=0>/n";
echo "<tr>/n";
echo "<td align=center><strong>您的IP:<font color=red>".$youip."</font></strong></td>/n";
echo "</tr>/n";
echo "<form method=POST action=portscan.php>/n";
echo "<tr><td>/n";
echo "<input type=text name=remoteip size=12>/n";
echo "<input type=submit value=扫描 name=scan>/n";
echo "</td></tr>/n";
echo "</form>";
echo "</table>/n";
// 如果表单为空则显示提交IP地址的表单 ?> <TABLE cellSpacing=0 cellPadding=10 width="100%" border=0>
<TR>
<TD align=center><b>Copyright © 2004 Security Angel Team[S4T] All Rights Reserved.</b></TD>
</TR>
</TABLE>
</center>
</body>
</html> 后记
这个扫描器很简单。就是用了一个数组来定义端口的相关信息,原理就是用fsockopen函数连接,如果可以连接,就表示端口打开,否则就是关闭。
最大的缺点就是PHP是单线程的,所以速度会很慢,这个是用方便、简单作为代价的,其实写这个代码的就是想告诉大家,PHP并不仅仅用于动态网站的开发,也可以用于网络安全领域,往往太注意事物的本职工作,就会忽略其他方面的特点。 
说明:本教程来源互联网或网友上传或出版商,仅为学习研究或媒体推广,wanshiok.com不保证资料的完整性。
2/2 首页 上一页 1 2 |