-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #726 from ae-utbm/honeypot
better honeypot logging
- Loading branch information
Showing
7 changed files
with
70 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
import logging | ||
from time import localtime, strftime | ||
from typing import Any | ||
|
||
from django.http import HttpResponse | ||
from django.test.client import WSGIRequest | ||
from django.http import HttpRequest, HttpResponse | ||
|
||
from core.utils import get_client_ip | ||
|
||
|
||
def custom_honeypot_error( | ||
request: WSGIRequest, context: dict[str, Any] | ||
request: HttpRequest, context: dict[str, Any] | ||
) -> HttpResponse: | ||
logging.warning(f"HoneyPot blocked user with ip {request.META.get('REMOTE_ADDR')}") | ||
logging.warning( | ||
f"[{strftime('%c', localtime())}] " | ||
f"HoneyPot blocked user with ip {get_client_ip(request)}" | ||
) | ||
return HttpResponse("Upon reading this, the http client was enlightened.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters