A fast, multi-threaded TCP/UDP port scanner written in Go.
- Scan TCP and UDP ports simultaneously
- Scan multiple hosts in a single command
- Accepts both hostnames and IP addresses (with automatic reverse DNS lookup)
- Configurable connection timeout and worker thread count
- Color-coded output: open ports in green, closed ports in red
- Concurrent scanning via goroutines for maximum speed
Install directly with go install:
go install github.com/Dapacruz/scanport@latestThe binary will be placed in your $GOPATH/bin (or $HOME/go/bin by default). Make sure that directory is in your $PATH.
Alternatively, build from source:
git clone https://github.com/Dapacruz/scanport.git
cd scanport
go build -o scanport .scanport -host <host[,host...]> [-tcp <port[,port...]>] [-udp <port[,port...]>] [options]
At least one -host and one port flag (-tcp or -udp) are required.
| Flag | Default | Description |
|---|---|---|
-host |
— | Comma-separated list of hostnames and/or IP addresses to scan |
-tcp |
— | Comma-separated list of TCP ports to scan |
-udp |
— | Comma-separated list of UDP ports to scan |
-t |
1 |
Connection timeout in seconds |
-w |
100 |
Maximum number of concurrent worker threads |
Scan a single host for common web ports over TCP:
scanport -host www.example.com -tcp 80,443Scan multiple IP addresses for a UDP port:
scanport -host 8.8.8.8,8.8.4.4 -udp 53Scan multiple hosts for both TCP and UDP ports with a custom timeout:
scanport -host www.google.com,www.vmware.com -tcp 80,443 -udp 53 -t 5Reduce concurrency to avoid connection limits:
scanport -host 192.168.1.1 -tcp 22,80,443,8080 -w 10Scanning ports ...
93.184.216.34 (www.example.com) ==> TCP/80 is open
93.184.216.34 (www.example.com) ==> TCP/443 is open
Scan complete: 1 host(s) scanned in 0.243 seconds
Open ports are printed in green and closed ports in red.
too many open files error
This occurs when the number of concurrent connections exceeds your OS's open file descriptor limit. Lower the worker count with -w:
scanport -host <target> -tcp <ports> -w 20You can also raise the system limit temporarily:
ulimit -n 4096Host cannot be resolved
Ensure the hostname is spelled correctly and that your DNS is reachable. You can also pass an IP address directly with -host.
UDP scan results are unreliable
UDP is a connectionless protocol. A port reported as "closed" means no response was received within the timeout window — this can be a false negative due to firewalls or packet loss. Increase the timeout with -t for more reliable results:
scanport -host <target> -udp 53 -t 5This project is licensed under the MIT License.