An interactive and CLI-friendly wrapper around nmap that streamlines common scans, adds smart defaults, saves results automatically, and can present structured results from XML output.
- Guided interactive mode or fully non-interactive CLI mode
- Smart host discovery control (only uses
-Pnwhen appropriate) - Privilege awareness (auto-switches
-sSto-sTwhen not root; warns for OS detection) - Robust subprocess handling and progress display
- Automatic output saving with
-oAto timestamped files (XML, greppable, and normal) - XML parsing for reliable, structured results (falls back to parsing stdout)
- Improved local network detection (attempts true CIDR; falls back to
/24) - Simple UX toggles like
--no-emoji,--no-confirm,--no-dns,--no-save
- Python 3.8+
- nmap installed on your system
- macOS:
brew install nmap - Ubuntu/Debian:
sudo apt-get install nmap - CentOS/RHEL:
sudo yum install nmap
- macOS:
- Optional:
netifacesfor more accurate local network detectionpip install netifaces
No installation required. Place Nmap.py anywhere on your system. Example:
# optional: create a Python virtual environment
python3 -m venv .venv && source .venv/bin/activate
# optional: better local network detection
pip install netifacesYou can run the script in two ways: interactive (guided prompts) or non-interactive (CLI flags).
python3 Nmap.pyYou will be asked to select a target (single host or local network), a firewall profile, a scan type, and timing. The script shows an estimated duration, asks for confirmation, then runs the scan and saves results.
Provide flags to skip prompts. Minimal example:
python3 Nmap.py --target 192.168.1.10 --mode single --scan-type 1 --timing T4 --no-confirm--targetTarget IP/hostname or CIDR (e.g.,192.168.1.0/24)--modesingleornetwork(defaults tonetworkif CIDR is provided, elsesingle)--scan-typeMenu number for scan type (see below)--timingOne ofT0..T5(defaults toT3)--firewall0(none),1(moderate),2(strong); adds light/strong evasion options--skip-discoverySkip host discovery (-Pn) when appropriate--portsCustom port list/range for-p(e.g.,22,80,443or1-1024)--top-portsUse--top-ports N--udpInclude UDP scan (-sU)--all-portsScan all ports (-p-)--scriptsNSE scripts (e.g.,default,vuln)--script-argsNSE script arguments--output-dirDirectory to save result files (default:results/scan-YYYYmmdd-HHMMSS)--no-confirmRun without interactive confirmation--no-emojiDisable emoji in output--no-dnsDisable reverse DNS (-n) to speed up scans--no-saveDo not save-oAoutputs
Network mode:
- Network Discovery (ping sweep + ARP)
- Basic Network Scan (discovery + top ports + version)
- Service Detection (versions + banners)
- OS Fingerprinting (TCP/IP stack analysis)
- Advanced Device Discovery (OS + services + MAC vendors)
- Stealth SYN Scan (half-open)
- UDP Scan (common UDP services)
- Comprehensive Network Audit (balanced, uses
-Awith top ports)
Single target mode:
- TCP SYN Scan (stealth)
- TCP Connect Scan (full connection)
- UDP Scan
- FIN Scan
- NULL Scan
- XMAS Scan
- ACK Scan
- Window Scan
- Maimon Scan
- Idle Scan (zombie host)
- Service Version Detection
- OS Detection
- Script Scan (default,vuln)
- Comprehensive Target Audit (
-A -p-)
- Quick single-host SYN scan with faster timing:
python3 Nmap.py --target 192.168.1.10 --mode single --scan-type 1 --timing T4 --no-confirm
- Discover hosts on local network:
python3 Nmap.py --target 192.168.1.0/24 --mode network --scan-type 1 --no-confirm --no-dns
- UDP top 200 ports on a host with output saved to
scans/:python3 Nmap.py --target 10.0.0.5 --mode single --scan-type 3 --udp --top-ports 200 --no-confirm --output-dir scans
- Comprehensive single-host audit:
python3 Nmap.py --target example.com --mode single --scan-type 14 --timing T4 --no-confirm
By default, results are saved with -oA to results/scan-YYYYmmdd-HHMMSS:
scan-*.nmapHuman-readable outputscan-*.gnmapGreppable outputscan-*.xmlXML output (used for reliable structured parsing in the script)
You can change the destination using --output-dir, or disable saving with --no-save.
- Some scans (e.g., SYN
-sS, parts of OS detection, UDP behaviors) require root for best results. - If not running as root, the script will automatically switch
-sSto-sTand warn you. OS detection may be less accurate.
- The script only applies
-Pn(skip discovery) when explicitly requested (via--skip-discoveryor high firewall profile) and when it won’t defeat a pure discovery scan. - Use
--no-dns(adds-n) to speed up scans by disabling reverse DNS lookups.
nmap not found: Install nmap (see Requirements) and ensure it is in your PATH.- Empty/partial results: Try
--timing T4or remove--skip-discovery. Consider running with elevated privileges for SYN/OS detection. - Slow scans: Avoid
-p-or large UDP scans; use--top-portsor-Fand--no-dns. - XML parsing error: The script will fall back to parsing stdout. You can inspect the corresponding
.xmlin the results folder.