|
|
@@ -5,6 +5,9 @@ from Crypto.Cipher import PKCS1_v1_5 as PKCS1_cipher
|
|
|
from Crypto.Cipher import AES
|
|
|
from functools import wraps
|
|
|
from utils.http import make_json_response
|
|
|
+from urllib import parse
|
|
|
+from django.http import JsonResponse
|
|
|
+
|
|
|
import json
|
|
|
|
|
|
IV = '16-Bytes--String'
|
|
|
@@ -50,6 +53,8 @@ def secure_transport(view_func):
|
|
|
except:
|
|
|
print('不是json')
|
|
|
loaded = {}
|
|
|
+ plain_text = parse.unquote(plain_text)
|
|
|
+ print(plain_text)
|
|
|
for p in map(lambda s: s.split('='), plain_text.split('&')):
|
|
|
loaded[p[0]] = p[1]
|
|
|
dec_request = request
|
|
|
@@ -57,6 +62,9 @@ def secure_transport(view_func):
|
|
|
|
|
|
raw_response = view_func(dec_request, *args, **kwargs)
|
|
|
|
|
|
+ if not isinstance(raw_response, JsonResponse):
|
|
|
+ return raw_response
|
|
|
+
|
|
|
content = json.dumps({'data': json.loads(raw_response.content)}).encode('utf-8')
|
|
|
padding = 16 - len(content) % 16
|
|
|
content += bytes([padding] * padding)
|