Skip to content

Commit

Permalink
created port scanner
Browse files Browse the repository at this point in the history
  • Loading branch information
ninijay committed Oct 28, 2017
1 parent 3dea571 commit b0cd065
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Usage:
python unzip.py -f <zipfile> -d <dictionary_file>
`

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
Expand Down
39 changes: 39 additions & 0 deletions scanners/port_scanner.py
Original file line number Diff line number Diff line change
@@ -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 <target host> -p <target port(s) separated by comma>'))
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()

0 comments on commit b0cd065

Please sign in to comment.