Skip to content

Instantly share code, notes, and snippets.

@dgroddick
Last active Sep 6, 2021
Embed
What would you like to do?
package main
import (
"fmt"
"net"
)
func main() {
for i := 1; i <= 1024; i++ {
address := fmt.Sprintf("scanme.nmap.org:%d", i)
conn, err := net.Dial("tcp", address)
if err != nil {
continue
}
conn.Close()
fmt.Println("Port %d is open.\n", i)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment