https://github.com/dcso/gonmap
go wrapper for the port and vulnerability scanner nmap
https://github.com/dcso/gonmap
Last synced: 6 months ago
JSON representation
go wrapper for the port and vulnerability scanner nmap
- Host: GitHub
- URL: https://github.com/dcso/gonmap
- Owner: DCSO
- License: other
- Created: 2018-03-21T16:00:01.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-21T16:02:08.000Z (about 7 years ago)
- Last Synced: 2024-06-21T12:18:07.030Z (12 months ago)
- Language: Go
- Size: 4.88 KB
- Stars: 7
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
gonmap - Wrapper around Nmap
============================Copyright (c) 2017, 2018, DCSO Deutsche Cyber-Sicherheitsorganisation GmbH
gonmap is a wrapper around the Nmap tool. It uses the XML output capability
of Nmap to retrieve results and make them available in Go.Implemented capabilities
------------------------* Simple port scanner for 1 host using either TCP or UDP.
Dependencies
------------gonmap requires the Nmap tool to be available in the user's $PATH.
Quick start
-----------```
import (
"fmt"
"os""github.com/DCSO/gonmap"
)func main() {
scan, err := gonmap.NewPortScan("localhost", []string{"tcp"})
if err != nil {
fmt.Printf("nmap failed: %s", err)
os.Exit(1)
}
scan.Run()f := "%5d/%s %-15s %s\n"
ft := "%9s %-15s %s\n"
for _, host := range scan.Result().Hosts {
fmt.Printf("Nmap scan report for %s\n", host.Address.Address)
fmt.Printf(ft, "PORT", "STATE", "SERVICE")
for _, p := range host.Ports {
fmt.Printf(f, p.Port, p.Protocol, p.Status.State, p.Service.Name)
}
}
}
```Possible output of the above example:
```
Nmap scan report for 127.0.0.1
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
3306/tcp open mysql
5000/tcp open upnp
5432/tcp open postgresql
```License
-------This project is licensed under a 3-clause BSD-like license.