Redirecting bots to utilize their time better...
Project description
django_spam
Inspired by this Nick Craver tweet https://twitter.com/nick_craver/status/720062942960623616
We all hate bots, lets admit it. Especially the ones that try to gain access to our most secret endpoints. Well we have an easy solution for your django application. django_spam simply adds common admin urls to url conf so when bots (or human for that matter) try and access them, they will get redirected...
Django 1.8 | Django 1.9 | Django 1.10 | Django 1.11 | Django 2.0 | Django 2.1 | Django 2.2 | |
---|---|---|---|---|---|---|---|
Python 2.7 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | |||
Python 3.4 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | ||
Python 3.5 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
Python 3.6 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | |||
Python 3.7 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
To install:
pip install django-spam
Add to apps list:
INSTALLED_APPS = [
'...',
'django_spam',
'...'
]
django_spam ships with some default endpoints bots might try to hit. If you would like to add extra routes, simply add
a SPAM_ROUTES
variable to your settings file that contains a list of extra endpoints you would like
to add. no leading slashes
SPAM_ROUTES = [
'admin.php',
'admin/login.php',
'administrator/index.php',
'index.php',
'...',
]
The same goes for SPAM_URLS
you would like traffic to get forwarded to. Add some fun urls:
SPAM_URLS = [
# 10 hours of Donald Trump saying bing bing bong
'https://www.youtube.com/watch?v=UKbOqEk6rsk',
# 10 hours of Darth Vader breathing
'https://www.youtube.com/watch?v=un8FAjXWOBY',
'...',
]
Include django_spam.urls
to root url file:
'...'
url(r'', include('django_spam.urls')), # for Django >= 2.0: path('', include('django_spam.urls')),
'...',
If for some odd reason you need to exclude routes, define EXCLUDED_ROUTES
in settings. no leading slashes
EXCLUDED_ROUTES = [
'admin.php',
'index.php'
]
@Tivix
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django_spam-0.4.2.tar.gz
.
File metadata
- Download URL: django_spam-0.4.2.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.4.2 requests/2.18.4 setuptools/44.1.0 requests-toolbelt/0.8.0 tqdm/4.23.2 CPython/2.7.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4bd15508e907c5a45d9f88cc1dcaad2005f33b7eb3c144c553da3bb5610fd78d |
|
MD5 | 0564e439a65042ed2ffb2a6b97c85385 |
|
BLAKE2b-256 | f2aa91bb37c0774bb2e128aa5473f11d01022f7c13890271f8953c9c30de41c3 |