python-nmap

A class to use Nmap and access scan results from Python
Download

python-nmap Ranking & Summary

Advertisement

  • Rating:
  • License:
  • GPL v3
  • Price:
  • FREE
  • Publisher Name:
  • Alexandre Norman
  • Publisher web site:
  • http://xael.org/norman/python/pyclamd/

python-nmap Tags


python-nmap Description

A class to use Nmap and access scan results from Python python-nmap is a Python library which helps in using the popular Nmap port scanner. It allows to easilly manipulate nmap scan results and will be a perfect tool for systems administrators who want to automatize scanning task and reports. It also supports nmap script outputs.Typical usage looks like:#!/usr/bin/env pythonimport nmap # import nmap.py modulenm = nmap.PortScanner() # instantiate nmap.PortScanner objectnm.scan('127.0.0.1', '22-443') # scan host 127.0.0.1, ports from 22 to 443nm.command_line() # get command line used for the scan : nmap -oX - -p 22-443 127.0.0.1nm.scaninfo() # get nmap scan informations {'tcp': {'services': '22-443', 'method': 'connect'}}nm.all_hosts() # get all hosts that were scannednm.hostname() # get hostname for host 127.0.0.1nm.state() # get state of host 127.0.0.1 (up|down|unknown|skipped)nm.all_protocols() # get all scanned protocols in (ip|tcp|udp|sctp)nm.keys() # get all ports for tcp protocolnm.all_tcp() # get all ports for tcp protocol (sorted version)nm.all_udp() # get all ports for udp protocol (sorted version)nm.all_ip() # get all ports for ip protocol (sorted version)nm.all_sctp() # get all ports for sctp protocol (sorted version)nm.has_tcp(22) # is there any information for port 22/tcp on host 127.0.0.1nm # get infos about port 22 in tcp on host 127.0.0.1nm.tcp(22) # get infos about port 22 in tcp on host 127.0.0.1nm # get state of port 22/tcp on host 127.0.0.1 (open# a more usefull example :for host in nm.all_hosts(): print '----------------------------------------------------' print 'Host : %s (%s)' % (host, nm.hostname()) print 'State : %s' % nm.state() for proto in nm.all_protocols(): print '----------' print 'Protocol : %s' % proto lport = nm.keys() lport.sort() for port in lport: print 'port : %s\tstate : %s' % (port, nm) Requirements: · Python


python-nmap Related Software