import socket import threading import traceback
class scanThread(threading.Thread): def run(self): try: ss = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ss.connect((ip, port_counter)) print "%s | %d OPEN" % (ip, port_counter) ss.close() print "scanned: ",port_counter,"\n" except: traceback.print_exc() # end class ------------------- def scan(ip, thebegin, theend): global ip global thebegin global theend port_counter = 0 for port_counter in range(thebegin, theend): scanThread().start() # end function ------------------- scan("localhost", 0, 10000) -- http://mail.python.org/mailman/listinfo/python-list