Skip to content

Instantly share code, notes, and snippets.

@brianteachman
brianteachman / python-nmap_example.py
Created March 7, 2013 18:57
Quick port scan script in python using python-nmap.
# http://xael.org/norman/python/python-nmap
# lets check for common ports using nmap
import nmap
nmScan = nmap.PortScanner()
nmScan.scan('127.0.0.1', '0-1023')
for port in nmScan['127.0.0.1']['tcp']:
thisDict = nmScan['127.0.0.1']['tcp'][port]
print 'Port ' + str(port) + ': ' + thisDict['product'] + ', v' + thisDict['version']