update prints to log
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import json
|
||||
import random
|
||||
import logging
|
||||
from functools import lru_cache
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
from django.contrib.humanize.templatetags.humanize import intcomma
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
@@ -274,9 +277,7 @@ class FakeAdminLoginView(View):
|
||||
ip = x_forwarded_for.split(',')[0]
|
||||
else:
|
||||
ip = request.META.get("REMOTE_ADDR")
|
||||
print(ip)
|
||||
print(len(ip))
|
||||
print(type(ip))
|
||||
logger.info(f"Honeypot GET request from IP: {ip}, length: {len(ip)}, type: {type(ip).__name__}")
|
||||
hacker, created = SecurityBreachAttemptModel.objects.get_or_create(ip_address=ip)
|
||||
return render(request, 'admin/fake_login.html', self.get_context(request))
|
||||
|
||||
@@ -286,7 +287,7 @@ class FakeAdminLoginView(View):
|
||||
ip = x_forwarded_for.split(',')[0]
|
||||
else:
|
||||
ip = request.META.get("REMOTE_ADDR")
|
||||
print(ip)
|
||||
logger.warning(f"Honeypot POST request from IP: {ip}")
|
||||
hacker, created = SecurityBreachAttemptModel.objects.get_or_create(ip_address=ip)
|
||||
hacker.trys += 1
|
||||
hacker.save()
|
||||
|
||||
Reference in New Issue
Block a user