Skip to content

Instantly share code, notes, and snippets.

@dgroddick
Last active September 6, 2021 01:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dgroddick/c6a29230414d587de902120ba62ddecf to your computer and use it in GitHub Desktop.
Save dgroddick/c6a29230414d587de902120ba62ddecf to your computer and use it in GitHub Desktop.
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