python-nmap
This is a python class to use nmap and access scan results from python3
What it is and what it does
python-nmap is a Python wrapper around the nmap command-line port scanner that lets you invoke nmap from Python code and parse its results into structured objects. It provides a PortScanner class for synchronous scans and PortScannerAsync for non-blocking scans with callbacks, plus helper methods to query host state, open ports, service names, and other scan metadata. Results can be exported to CSV or iterated progressively.
The package is designed for systems administrators and developers who want to automate network scanning tasks and generate reports programmatically. It has no runtime dependencies beyond nmap itself being installed on the system, but requires that nmap be in the system PATH to function.
Use it for:
- Automate port scanning and service discovery across multiple hosts in a network monitoring script
- Build a network inventory tool that queries host availability and open ports on a schedule
- Export nmap scan results to CSV for reporting or integration with other tools
- Run non-blocking network scans with callbacks in long-running applications using PortScannerAsync
- Programmatically check specific ports on a host as part of a deployment or health-check workflow
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Python wrapper for the nmap port scanner that parses scan results into queryable objects and supports both synchronous and asynchronous scanning modes.
No. The package is abandoned (no releases since 2021-10-26) and requires nmap as an external system dependency, creating high install friction. While it works for basic nmap automation, the maintenance gap means it may not handle modern nmap output formats or Python versions reliably. For new projects, consider calling nmap directly via subprocess or using an actively maintained alternative.
Install
python-nmap on PyPI
pip
pip install python-nmapuv
uv add python-nmappoetry
poetry add python-nmapInstalling python-nmap
Before you install
Installation requires nmap to be present on the system; the package itself has no runtime dependencies but is marked as abandoned with no releases since 2021-10-26. High install friction due to external system dependency.
License in practice
Licensed under GPL (copyleft); distributing this package or modifications requires source code disclosure under the same license terms.
Quickstart
import nmap
nm = nmap.PortScanner()
nm.scan('127.0.0.1', '22-443')
for host in nm.all_hosts():
print(host, nm[host].state())
nmap must be installed and available in system PATH; the package is a Python wrapper around the nmap executable, not a standalone scanner.
Verify before relying
- Whether the package works reliably with modern nmap versions released after 2021-10-26
- Current compatibility with Python versions beyond those tested during active development
- Whether async functionality remains stable given the long maintenance gap
Package facts
| License | gpl-3.0.txt (copyleft) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | abandoned — 1,753 days since the last release |
| First released | |
| Downloads | 294,508/month — #7,945 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: python-nmap-0.7.1.tar.gz
Keywords: nmap
Tags
More Monitoring packages
Wraps any iterable to display a real-time…
copyleft · top 100 on PyPI
opentelemetry-semantic-conventionsProvides generated Python code for…
permissive · top 100 on PyPI
opentelemetry-sdkProvides the reference implementation of the…
permissive · top 100 on PyPI
opentelemetry-apiProvides the abstract API and interfaces for…
permissive · top 100 on PyPI
opentelemetry-exporter-otlp-proto-httpExports OpenTelemetry observability data to an…
permissive · top 1,000 on PyPI
opentelemetry-instrumentationProvides automatic instrumentation commands and…
permissive · top 1,000 on PyPI
python3-nmapWraps nmap port scanner commands as Python…
unclear · top 15,000 on PyPI
ncclientncclient is a Python library that implements…
permissive · top 5,000 on PyPI
cisco-ai-mcp-scannerScans MCP (Model Context Protocol) servers and…
unclear · top 15,000 on PyPI
pynngProvides Python bindings for nng (nanomsg next…
permissive · top 15,000 on PyPI
aiodiscoverDiscovers hosts on a local network by…
permissive · top 15,000 on PyPI
zaproxyPython client library for the OWASP ZAP…
permissive · top 15,000 on PyPI
sslyzeSSLyze is a fast SSL/TLS scanning tool and…
agpl · top 15,000 on PyPI
aiosmtplibaiosmtplib is an asynchronous SMTP client that…
permissive · top 5,000 on PyPI
bbotBBOT is a multipurpose reconnaissance and…
agpl · top 15,000 on PyPI
sshconfsshconf reads and modifies SSH config files…
permissive · top 15,000 on PyPI