Speed up with threads
raims at dot.com
Sat Aug 3 11:07:27 CEST 2002
I've written a simple portscanner (two version: the first without
threads and the second one with threads). I just want to speed up more
the scanning, what can i do?
----------- code snippets -----------------
# this is a reasonable limit.
MAX_THREADS = 50
# it's the inherited run() method of the scanner class
# (inherits threading.Thread)
# connect to the given host:port
print "%s:%d OPEN" % (self.host, self.port)
# the scan method of the main class
def scan(self, host, start, stop):
self.port = start
while self.port < stop:
while threading.activeCount() < MAX_THREADS:
self.port = self.port + 1
Rhymes (rhymes at myself.com)
" ride or die "
More information about the Python-list