first commit
Some checks failed
Vulhub Format Check and Lint / format-check (push) Has been cancelled
Vulhub Format Check and Lint / markdown-check (push) Has been cancelled
Vulhub Docker Image CI / longtime-images-test (push) Has been cancelled
Vulhub Docker Image CI / images-test (push) Has been cancelled
Some checks failed
Vulhub Format Check and Lint / format-check (push) Has been cancelled
Vulhub Format Check and Lint / markdown-check (push) Has been cancelled
Vulhub Docker Image CI / longtime-images-test (push) Has been cancelled
Vulhub Docker Image CI / images-test (push) Has been cancelled
This commit is contained in:
22
django/CVE-2022-34265/web/vuln/views.py
Normal file
22
django/CVE-2022-34265/web/vuln/views.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from django.http import HttpResponse, JsonResponse
|
||||
from django.db.models.functions import Trunc
|
||||
from django.db.models import Count
|
||||
from .models import WebLog
|
||||
|
||||
|
||||
def create_log(request):
|
||||
method = request.method
|
||||
url = request.build_absolute_uri()
|
||||
user_agent = request.META.get('HTTP_USER_AGENT')
|
||||
WebLog.objects.create(
|
||||
method=method,
|
||||
url=url,
|
||||
user_agent=user_agent
|
||||
)
|
||||
|
||||
|
||||
def vul(request):
|
||||
create_log(request)
|
||||
date = request.GET.get('date', 'minute')
|
||||
objects = list(WebLog.objects.annotate(time=Trunc('created_time', date)).values('time').order_by('-time').annotate(count=Count('id')))
|
||||
return JsonResponse(data=objects, safe=False)
|
Reference in New Issue
Block a user