Skip to content

Instantly share code, notes, and snippets.

@nuit
Created July 26, 2014 14:27
Show Gist options
  • Save nuit/796b0110fb7bcf89ce38 to your computer and use it in GitHub Desktop.
Save nuit/796b0110fb7bcf89ce38 to your computer and use it in GitHub Desktop.
Nmap fun
import nmap
import optparse
def nmapScan(tgtHost, tgtPort):
nmScan = nmap.PortScanner()
nmScan.scan(tgtHost, tgtPort)
state=nmScan[tgtHost]['tcp'][int(tgtPort)]['state']
print " [*] " + tgtHost + " tcp/"+tgtPort+" "+state
def main():
parser = optparse.OptionParser('usage%prog' +
'-H <target host> -p <target port>')
parser.add_option('-H', dest='tgtHost', type='string',
help='specify target host')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment