Let's say that I avoid the complexities of using classes, and that I avoid using anything to count the threads...
 
import socket
import threading

def scan(ip, port):
    try:
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        s.connect((ip, port))
        s.close()
        print '%s | %d OPEN \nscanned: %d' % (ip, port, port)
    except:
        print '%s | %d CLOSED \nscanned: %d' % (ip, port, port)
ip = 'localhost'
for port in range(1, 1024):
   thread.start_new_thread(scan, (ip, port,))
 
 
Why does this produce the errr - can't start new thread? I just scrapped the rest of the code before, followed peoples ideas, and removed the complexities, I can learn the rest later I guess...
thanks again.
 
-edward
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to