对端口进行扫描基于连接,在go
中我们可以使用net.Dial
进行判断,如果返回的结果没有错误,那么这个端口就应该是打开的,如果返回了错误,那么可以说明这个端口是关闭的,代码如下
func ScanPort(protocol string, hostname string, port int) bool {
fmt.Printf("scanning port %d \n", port)
p :=
对端口进行扫描基于连接,在go
中我们可以使用net.Dial
进行判断,如果返回的结果没有错误,那么这个端口就应该是打开的,如果返回了错误,那么可以说明这个端口是关闭的,代码如下
func ScanPort(protocol string, hostname string, port int) bool {
fmt.Printf("scanning port %d \n", port)
p :=