python3-nmap
Python3-nmap converts Nmap commands into python3 methods making it very easy to use nmap in any of your python pentesting projects
What it is and what it does
python3-nmap is a Python wrapper around the nmap command-line port scanner that exposes nmap functionality as Python methods and classes. Instead of constructing shell commands, you instantiate Nmap objects and call methods to run scans and receive results as JSON. The library organizes nmap's capabilities into three main classes: Nmap (general scanning), NmapScanTechniques (various scan types), and NmapHostDiscovery (discovery modes).
The package depends on simplejson for result serialization and requires nmap itself to be installed on the system. It supports Python 3.6 and later. Several operations require root privileges. The library is useful for automating network reconnaissance tasks within Python scripts, though it remains a thin wrapper around nmap rather than a reimplementation.
Use it for:
- Automate port scanning and service discovery in Python security testing scripts without shell command construction.
- Batch scan multiple hosts and parse structured JSON results for reporting or downstream analysis.
- Integrate OS detection and version identification into Python-based network inventory or assessment tools.
- Run DNS brute-force subdomain enumeration via nmap scripts through Python method calls.
- Combine multiple scan techniques in a single Python workflow for comprehensive host reconnaissance.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Wraps nmap port scanner commands as Python methods, converting command-line nmap operations into callable functions that return JSON-structured results.
Yes, with conditions. Install if you need to automate nmap scans from Python and can tolerate the aging maintenance status (698 days since last release). Verify the unclear license before use in proprietary contexts. Requires nmap to be pre-installed on the system and root access for certain operations. No known security vulnerabilities.
Install
python3-nmap on PyPI
pip
pip install python3-nmapuv
uv add python3-nmappoetry
poetry add python3-nmapInstalling python3-nmap
Before you install
Low install friction with a single runtime dependency (simplejson). Maintenance status is aging—last release was 698 days ago, though the repository remains active with 313 stars and a recent commit on 2025-09-10.
License in practice
License treatment is unclear; no SPDX identifier or raw license text is available in the package metadata. Verify the actual license before use in proprietary or restricted contexts.
Quickstart
pip install python3-nmap
import python3_nmap
results = python3_nmap.Nmap().scan_top_ports("your-host.com")
Requires nmap to be installed on the system. Some operations require root/superuser privileges.
Verify before relying
- Whether the package is actively maintained or in maintenance-only mode given the 698-day gap since last release.
- Actual license terms, since license_treatment is unclear and no SPDX identifier is present.
- Cross-platform support claim (Windows and Linux) and any platform-specific limitations.
- Which specific operations require root privileges beyond those documented in the description excerpt.
Package facts
| License | not declared (unclear) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — simplejson |
| Maintenance | aging — 698 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 232,576/month — #9,063 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: python3_nmap-1.9.1-py3-none-any.whl
Tags
More Networking packages
h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
psutilpsutil retrieves real-time information about…
permissive · top 1,000 on PyPI
pyOpenSSLpyOpenSSL wraps OpenSSL's SSL/TLS functionality…
permissive · top 1,000 on PyPI
uvloopuvloop is a drop-in replacement for Python's…
permissive · top 1,000 on PyPI
execnetexecnet lets you spawn and communicate with…
permissive · top 1,000 on PyPI
pyzmqPyZMQ provides Python bindings for ZeroMQ…
permissive · top 1,000 on PyPI
python-nmapPython wrapper for the nmap port scanner that…
copyleft · top 15,000 on PyPI
port-forport-for finds and remembers unused TCP…
permissive · top 5,000 on PyPI
cisco-ai-mcp-scannerScans MCP (Model Context Protocol) servers and…
unclear · top 15,000 on PyPI
bbotBBOT is a multipurpose reconnaissance and…
agpl · top 15,000 on PyPI
safetySafety CLI scans Python project dependencies…
permissive · top 5,000 on PyPI
ipaddressProvides IPv4 and IPv6 address manipulation for…
permissive · top 5,000 on PyPI
aiodiscoverDiscovers hosts on a local network by…
permissive · top 15,000 on PyPI
nslookupProvides high-level DNS lookups (A, AAAA, and…
copyleft · top 15,000 on PyPI
netaddrRepresents and manipulates IPv4, IPv6, MAC…
permissive · top 5,000 on PyPI
portpickerFinds and returns an unused network port on the…
permissive · top 5,000 on PyPI