Note: Only utilize a port scanner on sites you have permission to test. Also, note the legalities of port scanners in your territories.
As I’m learning the Go language, I thought I’d work on a small project of making a utility I wrote in Python, in the Go language. In this case, I chose a port scanner I wrote in Python. The scanner tries to interrogate ports and return any banner that would indicate what’s installed there.
The original code I wrote in Python utilized the socket and sys libraries. I wrote it while taking an InfoSec course over at Offensive Security. Anyway… years later, I’m thinking of a project to try and do in Go (just go kick the tires and get used to the code) and I figure I might as well port that project into Go.
Go Port Scanner
The code is simple it basically kicks off a shell prompt asking for a host, then a starting port and an ending port. It then iterates over the port range, trying each port in turn.
Here’s the code (link):