django-honeyguard

📖 Documentation: https://django-honeyguard.readthedocs.io
HoneyGuard is a reusable Django app that provides fake admin login pages (honeypots) for Django and WordPress, logs suspicious requests, detects timing anomalies, and optionally sends alerts. Protect your real admin by wasting attackers’ time and gathering intelligence safely.
Features
- Live timing detection (too-fast/too-slow submissions)
- Hidden honeypot field detection
- Fake login pages for Django Admin and WordPress
- Comprehensive logging with risk scores
- Pluggable signal to integrate custom handlers
- Optional email alerts and console logging
- URL include or drop-in views usage
- Strict settings validation at startup
Preview
The package ships with templates for:
django_honeyguard/django_admin_login.html(fake Django admin)django_honeyguard/wp_admin_login.html(fake WordPress admin)
Include the URLs and visit /admin/ or /wp-admin.php to see the honeypots in action.
Requirements
- Django >= 5.0.0
- Python >= 3.10
Installation
Install from PyPI:
pip install django-honeyguard
Add the app to INSTALLED_APPS:
# settings.py
INSTALLED_APPS = [
# ...
"django_honeyguard",
]
Include the URLs (Option A), or wire views directly (Option B):
# urls.py
from django.urls import include, path
urlpatterns = [
# Option A: include both fake admin pages
path("", include("django_honeyguard.urls")),
# Option B: use individual views
# from django_honeyguard.views import FakeDjangoAdminView, FakeWPAdminView
# path("admin/", FakeDjangoAdminView.as_view()),
# path("wp-admin.php", FakeWPAdminView.as_view()),
]
Run migrations (creates log table):
python manage.py migrate
Settings (settings.py)
You can configure HoneyGuard via a HONEYGUARD dictionary or individual HONEYGUARD_* settings. Defaults shown below:
HONEYGUARD = {
# Email alerts
"EMAIL_RECIPIENTS": [],
"EMAIL_SUBJECT_PREFIX": "🚨 Honeypot Alert",
"EMAIL_FROM": None, # Uses Django DEFAULT_FROM_EMAIL if None
"EMAIL_FAIL_SILENTLY": True, # Do not crash on email errors
# Timing detection (seconds)
"TIMING_TOO_FAST_THRESHOLD": 2.0,
"TIMING_TOO_SLOW_THRESHOLD": 600.0,
# Logging
"ENABLE_CONSOLE_LOGGING": True,
"LOG_LEVEL": "WARNING", # DEBUG, INFO, WARNING, ERROR, CRITICAL
# Detection behavior
"ENABLE_GET_METHOD_DETECTION": False, # Detect on GET as well as POST
# Field limits
"MAX_USERNAME_LENGTH": 150,
"MAX_PASSWORD_LENGTH": 128,
"WORDPRESS_USERNAME_MAX_LENGTH": 60,
"WORDPRESS_PASSWORD_MAX_LENGTH": 255,
# Error messages (shown on fake pages)
"DJANGO_ERROR_MESSAGE": (
"Please enter a correct username and password. Note that both fields"
" may be case-sensitive."
),
"WORDPRESS_ERROR_MESSAGE": (
"<strong>Error:</strong> The password you entered for the username is incorrect."
),
}
Usage
- Visit
/admin/for the fake Django admin login page - Visit
/wp-admin.phpfor the fake WordPress login page - Submissions and suspicious GETs will be logged via the
honeypot_triggeredsignal
Listen to the honeypot_triggered signal to add custom behaviors:
from django_honeyguard.signals import honeypot_triggered
from django.dispatch import receiver
@receiver(honeypot_triggered)
def my_handler(sender, request, data, **kwargs):
# data contains ip_address, path, username, timing info, risk_score, etc.
pass
Documentation
Complete documentation is available at: https://django-honeyguard.readthedocs.io/
Running the docs locally:
git clone https://github.com/alihtt/django-honeyguard.git
cd django-honeyguard
python -m venv .venv && source .venv/bin/activate
pip install -r docs/requirements.txt
cd docs && make html
# open _build/html/index.html in your browser
Notes
- This package does not replace Django’s real authentication; it provides decoy pages and logging.
- Always secure your real admin at a non-obvious URL and behind proper authentication and rate limiting.
Metadata
Release files for django-honeyguard 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_honeyguard-1.0.0.tar.gz | 63.8 kB | Without provenance | Details for django_honeyguard-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_honeyguard-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for django_honeyguard-1.0.0-py3-none-any.whl |
Total release size: 195.2 kB
Release files / django_honeyguard-1.0.0.tar.gz
| Download URL | django_honeyguard-1.0.0.tar.gz |
|---|---|
| Size | 63.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
14f26ca798bc441c899ea7f8439420b7f45bc330eb105269b7ac8780d10530e4
|
|
BLAKE2b-256 checksum How to use checksums |
d54e85480b60e9fb9d968e67faff92c287b6a5eaf10510e4dddb9aa6570e575e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / django_honeyguard-1.0.0-py3-none-any.whl
| Download URL | django_honeyguard-1.0.0-py3-none-any.whl |
|---|---|
| Size | 131.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
beafbbd0f40a1978be908b0cc477f13cd27a04df56f755f4a24c3f39b4dd7ee8
|
|
BLAKE2b-256 checksum How to use checksums |
b29c3f551edeecd18533e6c85d394570b5f12f732e589fb6d3827c3d8ccd2353
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for django-honeyguard 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.