skillfed

python-nmap

This is a python class to use nmap and access scan results from python3

python-nmap v0.7.1 294.5K downloads/30d#7,945 on PyPI
Copyleft license gpl-3.0.txt Abandoned released

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-nmap

uv

uv add python-nmap

poetry

poetry add python-nmap

Installing 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

Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersIntended Audience :: System AdministratorsLicense :: OSI Approved :: GNU General Public License (GPL)Operating System :: OS IndependentProgramming Language :: PythonTopic :: System :: MonitoringTopic :: System :: NetworkingTopic :: System :: Networking :: FirewallsTopic :: System :: Networking :: Monitoring

Tags

nmap python wrapperport scanner automationnetwork scanning librarynmap results parsingasynchronous port scanningnetwork host discoveryservice enumeration tool
network-scanningabandoned

More Monitoring packages