Gomap is a fully self-contained nmap like module for Golang. Unlike other projects which provide nmap C bindings or rely on other local dependencies, gomap is a fully implemented in pure Go. Gomap imports zero non-core modules making it ideal for applications that have zero control on the clients operating system. Since this is a small library, it only focuses on providing a few core features. For the most part its API is stable with changes being applied to its unexposed internal scanning functions.
- Parallel port scanning using go routines
- Automated CIDR range scanning
- Service prediction by port number
- SYN (Silent) Scanning Mode
- UDP Scanning (Non-Stealth)
- Fast and detailed scanning for common ports
- Pure Go with zero dependencies
- Easily integrated into other projects
- CIDR range size detection
Performs a fastscan for the most common ports on every IP on a local range
- Create
quickscan.go
package main
import (
"fmt"
"github.com/Wundark/gomap"
)
func main() {
var (
proto = "tcp"
fastscan = true
syn = false
)
scan, err := gomap.ScanRange(proto, fastscan, syn)
if err != nil {
// handle error
}
fmt.Printf(scan.String())
}
go mod init quickscan
go mod tidy
go run quickscan.go
Host: computer-name (192.168.1.132)
| Port Service
| ---- -------
|---- 22 ssh
Host: server-nginx (192.168.1.143)
| Port Service
| ---- -------
|---- 443 https
|---- 80 http
|---- 22 ssh
Host: server-minio (192.168.1.112)
| Port Service
| ---- -------
|---- 22 ssh
Host: some-phone (192.168.1.155)
|- No Open Ports
Performs a detailed stealth scan on a single IP
- Create
stealthmap.go
package main
import (
"fmt"
"github.com/Wundark/gomap"
)
func main() {
// Stealth scans MUST be run as root/admin
var (
fastscan = false
syn = true
proto = "tcp"
ip = "192.168.1.120"
)
scan, err := gomap.ScanIP(ip, proto, fastscan, syn)
if err != nil {
// handle error
}
fmt.Printf(scan.String())
}
go mod init stealthmap
go mod tidy
sudo go run stealthmap.go
Host: 192.168.1.120 | Ports Scanned 3236/3236
Host: Voyager (192.168.1.120)
| Port Service
| ---- -------
|---- 22 SSH Remote Login Protocol
|---- 80 World Wide Web HTTP
|---- 443 HTTP protocol over TLS/SSL