| 0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. | #!/usr/bin/python #Takes a list of sites/ips and checks if a port is open. #If the port is open, saves the site/ip to a file. #Mozi Project ;) #http://www.darkc0de.com #d3hydr8[at]gmail[dot]com import socket, sys def title(): print "\n\t d3hydr8[at]gmail[dot]com PortListScan v1.0" print "\t------------------------------------------------" def write(host): file = open(sys.argv[3], "a") file.writelines(host+" : "+port+"\n") file.close() def scan(host): if host[-1] == "\n": host = host[:-1] print "[-] Target:",host try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.settimeout(4) s.connect((socket.gethostbyname(host), int(port))) print "\n[+] OPEN:",host, port print "[+] Response:",s.recvfrom(1024)[0] write(host) s.close() except: pass if len(sys.argv) != 4: title() print "Usage: ./openports.py <list of sites/ips> <port> <saved file>" sys.exit(1) port = sys.argv[2] try: sites = open(sys.argv[1], "r").readlines() except(IOError): print "\nError: Check your site list path\n" sys.exit(1) title() print "\n[+] Sites Loaded:",len(sites) print "[+] Scanning...\n" for site in sites: scan(site) |