Created
July 26, 2014 14:27
-
-
Save nuit/796b0110fb7bcf89ce38 to your computer and use it in GitHub Desktop.
Nmap fun
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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