diff --git a/README.md b/README.md index 9f9b6d4..95eafd9 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Usage: python unzip.py -f -d ` -This script will crack a pw- protected zip file with a dictionary list. It will create a Thread for each dictionary_file line to speed up the process. +This script will crack a pw- protected zip file with a dictionary list. It will create a pseudo- Thread for each dictionary_file line to speed up the process. ## scanners ### simple\_vuln_scanner.py diff --git a/scanners/port_scanner.py b/scanners/port_scanner.py new file mode 100644 index 0000000..d4556ef --- /dev/null +++ b/scanners/port_scanner.py @@ -0,0 +1,39 @@ +import optparse +from socket import * +def connScan(tgtHost, tgtPort): + try: + connSkt = socket(AF_INET, SOCK_STREAM) + connSkt.connect((tgtHost, tgtPort)) + print "[+] %d/tcp open" % (tgtPort) + connSkt.close + except: + print "[-] %d/tcp closed" % tgtPort +def portScan(tgtHost, tgtPorts): + try: + tgtIP = gethostbyname(tgtHost) + except: + print "[-] Cannot resolve '%s': Unknown Host" % tgtHost + return + try: + tgtName = gethostbyaddr(tgtIP) + print "\n[+] Scan Results for: " + tgtName[0] + except: + print "\n[+] Scan Results for: " + tgtIP + setdefaulttimeout(1) + for tgtPort in tgtPorts: + print "Scanning port " + tgtPort + connScan(tgtHost, int(tgtPort)) +def main(): + parser = optparse.OptionParser(('usage %prog -H -p ')) + parser.add_option("-H", dest="tgtHost", type="string", help="specify tarhet host") + parser.add_option("-p", dest="tgtPort", type="int", help="specify target port(s) separated by comma") + (options, args) = parser.parse_args() + tgtHost = options.tgtHost + tgtPort = str(options.tgtPort) + tgtPorts = tgtPort.split(', ') + if (tgtHost == None) | (tgtPorts[0] == None): + print parser.usage + exit(0) + portScan(tgtHost, tgtPorts) +if __name__ == "__main__": + main() \ No newline at end of file