sleep in asyncore

B

billie

Hi all.
I'm writing an authentication server by using asyncore / asynchat
modules.
I'd like to implement a basic brute-force protection by "freezing /
sleeping" the current client session for a period of time (e.g. 2
seconds) when the user sends a wrong password.
Does someone knows a "trick" to do that with asyncore?


Thanks in advance for your helping.
 
F

Fredrik Lundh

billie said:
I'm writing an authentication server by using asyncore / asynchat
modules.
I'd like to implement a basic brute-force protection by "freezing /
sleeping" the current client session for a period of time (e.g. 2
seconds) when the user sends a wrong password.
Does someone knows a "trick" to do that with asyncore?

this could work:

add a timeout variable to your dispatcher instance, and have your "readable"
method returns False if timeout is set and the current time is before the given
value. then set the timeout value to time.time() + 2 when you see a bad pass-
word.

</F>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top