Skip to content

About

A lightweight Python 3 Nmap wrapper that doesn't try too hard. Gracefully handles any Nmap command, providing access to all output types (normal, greppable, xml), plus JSON!

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

18 stars

Watchers

3 watching

Forks

Latest commit

 

History

26 Commits

Folders and files

nmappalyzer

License Python Version Build Status

A lightweight Python 3 Nmap wrapper that doesn't try too hard. Gracefully handles any Nmap command, providing access to all output types (normal, greppable, xml), plus JSON!

Installation

NOTE: Nmap must be installed.

$ pip install nmappalyzer

Usage

  1. Start the scan and wait for it to finish
from nmappalyzer import NmapScan

#                target            Nmap args (optional)
scan = NmapScan('scanme.nmap.org', ['-Pn', '-F', '-T4' '-sV', '--script=banner'])
  1. Access information about the scan
scan.command
"/usr/bin/nmap -oA /tmp/rhw2r_q9 -Pn -F -T4 -sV --script=banner scanme.nmap.org"

# Terminal output
scan.stdout
# Terminal errors
scan.stderr

# Normal output
scan.results.output_nmap
# Greppable output
scan.results.output_gnmap
# XML output
scan.results.output_xml
# Parsed XML (lxml etree):
scan.results.etree
# Python dictionary (converted from xml)
scan.results.json
  1. Access information about the hosts
for host in scan:
    host.status
    host.address
    host.scripts
    host.hostnames
    host.open_ports
    host.closed_ports
    host.filtered_ports

    # Parsed XML (lxml etree)
    host.etree

    # Python dictionary (converted from xml)
    host.json

About

A lightweight Python 3 Nmap wrapper that doesn't try too hard. Gracefully handles any Nmap command, providing access to all output types (normal, greppable, xml), plus JSON!

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

18 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages