Skip to content

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!

License

Notifications You must be signed in to change notification settings

blacklanternsecurity/nmappalyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages