django-misery / README.md

django-misery

Overview

A simple ban system for Django, that does nasty stuff to trolls wandering on your website.

Users banned the classical way are encouraged to bypass the ban by creating another users or changing of IP address. A nastier and probably more effective way to do is to use what is known as slowban, and errorban. This Django middleware implement those.

Features

  • slowing page generation for miserable users
  • logging them out randomly
  • send a 404 from time to time...
  • ... or a 403...
  • ... or even a blank page if you want

Hey, they deserved it!

Pros:

  • lightweight, design not to slow a single bit your website (from a non-miserable point of view, of course)
  • support both IPv4 and IPv6

Cons:

  • does't currently support masks; yes, it can be handy against users having a botnet under control, or in case of a user having a IPv6 range, but the current implementation favors speed over features

Installation & configuration

To install the app, add django_misery to your INSTALLED_APPS setting, and django_misery.middleware.miserize to you MIDDLEWARE_CLASSES.

The following settings can be personnalized:

  • MISERY_SLOW_STRENGHT: seconds that miserable users will have to wait at least (maximum twice longer) (default: 6)
  • MISERY_LOGOUT_PROBABILITY: percentage of probability a user will be disconnected (default: 10)
  • MISERY_403_PROBABILITY: same for 403 (default: 10)
  • MISERY_404_PROBABILITY: I'm gonna let you guess for this one (default: 10)
  • MISERY_WHITE_SCREEN_PROBABILITY: same for a nice, 100% pure white (not a single subpixel in the viewport will be off, I promise) (default: 20)

Miscellanous

Inspired by the Drupal Misery module, see also "Suspension, Ban or Hellban?" for hellbanning.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.