1. [代码]在线端口扫描工具(http://www.atool.org/port_scanner.php

端口扫描器可以用于检查VPS服务器端口是否开放,对于网站和服务器的安全非常重要。

class Health {
	public static $status;
	public function __construct() {
	}
	public function check($ip, $port, $timeout = 2){
		$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
		socket_set_nonblock($sock);
		socket_connect($sock,$ip, $port);
		socket_set_block($sock);
		self::$status = socket_select($r = array($sock), $w = array($sock), $f = array($sock), 2);
		return(self::$status); 
	}
	public function status(){
		switch(self::$status)
		{
			case 2:
				return "Closed";
				break;
			case 1:
				return "Openning";
				break;
			case 0:
				return "Closed";
				break;
		}	
	}
}
登录后复制

2. [图片] _E6_9C_AA_E5_91_BD_E5_90_8D.png

在线端口扫描工具-LMLPHP

09-14 06:49