Python 3 wrapper around Nmap. It checks targets before the scan, runs Nmap, and prints port state, service details, and script output in color. Results can also be saved as JSON.
Author: Avi Twil
Scan only systems you own or have explicit permission to test. Unauthorized network scanning may be illegal. You are responsible for how you use this tool.
The screenshots below are from a local lab: a web server on 127.0.0.1 only. Other addresses in this README are documentation examples from RFC 5737 (203.0.113.0/24).
- Scan one host, a file of hosts, or a CIDR subnet
- Pass any Nmap flags through (
-sSis the default) - Color for open, filtered, and closed ports, plus service and OS details
- JSON export of the same result
- Reject targets that look like extra command-line flags
- You choose targets with
-t,-f, or-ts. - Snmap accepts only values that look like a host, hostname, or CIDR range. A value that starts with
-is skipped, so it cannot be smuggled in as another Nmap option. - The script calls Nmap through
python-nmap. - It prints each host in the terminal, or writes the same structure to a file when you pass
--json.
-flags must be the last option on the command line. Everything after it is handed to Nmap, including -t, -f, -ts, and --json.
You need Python 3 and Nmap on PATH. Some scan types (-sS, -sU, -O) need root.
git clone https://github.com/avitwil/Snmap.git
cd Snmap
python3 -m pip install -r requirements.txtOn Debian, Ubuntu, or Kali, ./dist/install.sh installs the nmap package and the Python dependencies.
The file you run is super_nmap.py.
Older v1 packages are on GitHub Releases, not in the git tree. They predate the current target checks. Prefer the source install above.
python3 super_nmap.py --helpThe help text prints a private-range placeholder (192.168.1.0/24). That line is not a host this project scanned.
| Option | Meaning |
|---|---|
-t, --target |
One host |
-f, --file |
Text file, one target per line |
-ts, --subnet |
CIDR subnet |
-flags, --flags |
Nmap flags. Must be last |
--json <file> |
Write results as JSON instead of printing them |
-h, --help |
Show the help menu |
Common Nmap flags to put after -flags: -sT, -sS, -sV, -O, -p, -F, --open, --script. The help menu lists the rest.
TCP connect scan of port 8080 on this machine, with service detection. Connect scan (-sT) does not need root.
python3 super_nmap.py -t 127.0.0.1 -flags -sT -sV -p 8080 --openExpected result for that local web server:
Host: 127.0.0.1
[ Ports ]
Port 8080/tcp: open | http SimpleHTTPServer 0.6 | Reason: syn-ack
Put --json before -flags.
python3 super_nmap.py -t 127.0.0.1 --json results.json -flags -sT -sV -p 8080The terminal ends with Results saved to results.json. The file from the local scan above looks like this:
{
"127.0.0.1": {
"ports": [
{
"protocol": "tcp",
"port": 8080,
"state": "open",
"service": "http",
"product": "SimpleHTTPServer",
"version": "0.6",
"reason": "syn-ack"
}
]
}
}printf '%s\n' 127.0.0.1 > hosts.txt
python3 super_nmap.py -f hosts.txt -flags -sT -p 8080Lines that are not valid targets are skipped with a warning. The rest are scanned.
203.0.113.0/24 is TEST-NET-3, reserved for examples. These commands are illustrations, not scans run for this README.
python3 super_nmap.py -t 203.0.113.10 -flags -sV
python3 super_nmap.py -ts 203.0.113.0/24 -flags -sT --openThis is correct. The target is parsed, then -sV is passed to Nmap:
python3 super_nmap.py -t 203.0.113.10 -flags -sVThis is wrong. -t and the address are swallowed as Nmap flags, and Snmap reports that no target was set:
python3 super_nmap.py -flags -sV -t 203.0.113.10- File not found: the
-fpath does not exist. - No valid targets: nothing passed the target check, or the target options were placed after
-flags. nmap program was not found in path: install Nmap and open a new shell.- SYN, UDP, or OS scans fail: run them with root, or use
-sTfor a connect scan.
MIT. See LICENSE.

