2018-06-30 15:29:56 +05:00
|
|
|
from django.conf import settings
|
|
|
|
|
from django.shortcuts import HttpResponse
|
2018-07-05 15:22:48 +05:00
|
|
|
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
2018-09-24 18:56:48 +05:00
|
|
|
import json
|
2018-06-30 15:29:56 +05:00
|
|
|
|
|
|
|
|
class secMiddleware:
|
|
|
|
|
|
|
|
|
|
def __init__(self, get_response):
|
|
|
|
|
self.get_response = get_response
|
|
|
|
|
|
|
|
|
|
def __call__(self, request):
|
|
|
|
|
if request.method == 'POST':
|
|
|
|
|
if request.body.find(';') > -1 or request.body.find('&&') > -1 or request.body.find('|') > -1 or request.body.find('...') > -1:
|
2018-07-05 15:22:48 +05:00
|
|
|
logging.writeToFile('Bad Input on.')
|
2018-06-30 15:29:56 +05:00
|
|
|
response = self.get_response(request)
|
2018-09-24 18:56:48 +05:00
|
|
|
return response
|
|
|
|
|
|
|
|
|
|
#def __call__(self, request):
|
|
|
|
|
# if request.method == 'POST':
|
|
|
|
|
# data = json.loads(request.body)
|
|
|
|
|
# for key, value in data.iteritems():
|
|
|
|
|
# if value.find(';') > -1 or value.find('&&') > -1 or value.find('|') > -1 or value.find('...') > -1:
|
|
|
|
|
# logging.writeToFile(request.body)
|
|
|
|
|
# return HttpResponse('Error')
|
|
|
|
|
# if key.find(';') > -1 or key.find('&&') > -1 or key.find('|') > -1 or key.find('...') > -1:
|
|
|
|
|
# logging.writeToFile(request.body)
|
|
|
|
|
# return HttpResponse('Error')
|
|
|
|
|
# response = self.get_response(request)
|
|
|
|
|
# return response
|