The problem may be something to do with using "threading" as identifier
name. It is name of a module and definitely what you want it done
anyway. You are better off having another variable as counter (with a
different name).
Raghu.
--
http://mail.python.org/mailman/listinfo/python-list
Let's say that I avoid the complexities of using classes, and that I avoid using anything to count the threads...
import socketimport threading
def scan(ip, port): try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((ip, port)) s.close() print '%s |
ed wrote:
> this script should create individual threads to scan a range of IP
> addresses, but it doesnt, it simple ... does nothing. it doesnt hang
> over anything, the thread is not being executed, any ideas anyone?
[SNIP]
> while threading < MAX_THREADS:
> scanThre
Why do you check if the module threading is less than 50? (this is why
nothing happens, it's always false).
>From where do you get port_counter in method run() of scanThread? (this
would make every call to run() raise an exception.
--
http://mail.python.org/mailman/listinfo/python-list
import socket
import thread
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:
pass
ip = 'localhost'
for port in range(50, 5000
Fredrik Lundh wrote:
> Bryan Olson wrote:
>
>>Next, you never create any instances of scanThread.
>
>
> one would think that the "scanThread()" part of
>
> scanThread().start()
>
> would do exactly that.
And one would be correct.
I hereby retract that assertion of my post.
--
--B
maybe try this
while threading.activeCount() < MAX_THREADS:
#
instead of
while threading < MAX_THREADS:
--
http://mail.python.org/mailman/listinfo/python-list
Ah shoot, never mind, I'm an idiot. =0
--
http://mail.python.org/mailman/listinfo/python-list
This may be a really stupid question, but are you actually CALLING your
scan() function anywhere?
--
http://mail.python.org/mailman/listinfo/python-list
> "ed" <[EMAIL PROTECTED]> (E) wrote:
> import socket
> import threading
> import traceback
> def scan(ip, thebegin, theend):
> global ip
> global thebegin
> global theend
Making parameters global is a bad idea (I think). Moreover, thebegin and
theend aren't used in s
> Bryan Olson <[EMAIL PROTECTED]> (BO) wrote:
>BO> ed wrote:
>>> this script should create individual threads to scan a range of IP
>>> addresses, but it doesnt, it simple ... does nothing. it doesnt hang
>>> over anything, the thread is not being executed, any ideas anyone?
>BO> It's because
Bryan Olson wrote:
> Next, you never create any instances of scanThread.
one would think that the "scanThread()" part of
scanThread().start()
would do exactly that.
--
http://mail.python.org/mailman/listinfo/python-list
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.cl
Well, I fixed those problems, now what I have is this:
but i am getting errors with the global variables or something ... am i supposed to use this class and def together differently? I just don't seem to understand ...
-edward
import socketimport threadingimport traceback
class scanThread(thr
ed wrote:
> this script should create individual threads to scan a range of IP
> addresses, but it doesnt, it simple ... does nothing. it doesnt hang
> over anything, the thread is not being executed, any ideas anyone?
It's because of the bugs. Nothing happens because
threading < MAX_THREADS
this script should create individual threads to scan a range of IP
addresses, but it doesnt, it simple ... does nothing. it doesnt hang
over anything, the thread is not being executed, any ideas anyone?
--
import socket
import threading
import traceback
MAX_THREADS = 50
class scanThrea
16 matches
Mail list logo