Created
February 14, 2018 15:08
-
-
Save basvandorst/4ba7d0f692b30e1eafea6fe5710d15f5 to your computer and use it in GitHub Desktop.
Simple multithreaded portscanner
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
from threading import Thread | |
import socket | |
def scan(ip, port): | |
try: | |
con = socket.socket() | |
result = con.connect_ex((ip,port)) | |
if result == 0: | |
print '[+] Port %d open' %port | |
else: | |
print '[-] Port %d closed' %port | |
except: | |
print '[-] Port %d error' %port | |
host = 'www.ping.nl' | |
ports = [21,22,25,53,80,8080] | |
for port in ports: | |
t = Thread(target=scan, args=(host, port)) | |
t.start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment