-
-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Basic flood detection #8
Comments
You can get the IP address from request headers.
The correct header will depend on the webserver or proxy you are running behind. How are you going to calculate the kB per minute with only the length sent? Check the length every minute or X seconds?
Rate limit user messages to 10 messages a second. Drop the excess messages. Alternatively you could disconnect a user instead. |
I agree with that solution @29d. Would you do a pull request? If so, I'll merge it. |
Thanks @29d . I added your flood control method (to be merged in a few minutes). About IP, I tested on 2 servers (Server1: Apache proxy forwarding to Python ; Server2: a VPS with direct access). Here are the results:
|
Rough idea:
On connect of a new client
ws
:We should do this each time a message is posted by a user
ws
:Then we should measure if the increase is more than, say, 1kB per minute. If so deconnect, and store the IP of the potential spammer.
If user comes back and second flood, add to IP ban list...
Something else: how to get IP from
ws
here with websocket: https://github.com/josephernest/talktalktalk/blob/master/talktalktalk.py#L75 ?The text was updated successfully, but these errors were encountered: