Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Created by Pathogen @ www.hakhub.tk
- import socket,sys,re
- def portscan(host):
- portrange = [21,22,23,25,80,110,111,143,445,631,1337,1433,3389,5631,5800,5900,5901,8080,8123,9050]
- # ^ The ports to scan ^
- for portnum in portrange:
- sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- if re.search('www',host):
- host = socket.gethostbyname(host)
- socket.setdefaulttimeout(4)
- try:
- sock.connect((host, portnum))
- sock.close()
- print str(portnum) + " open."
- except:
- pass
- try:
- portscan(sys.argv[1])
- except:
- print "No ports specified. (EX. python scan.py 127.0.0.1)"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement