664104f6 by 冯轩

MOD:统一处理x0字符

1 parent c8bacd75
from Crypto.Cipher import AES
from base64 import b64encode, b64decode
import re
def aes_encrypt_cbc(data, key, iv):
cipher = AES.new(key, AES.MODE_CBC, iv)
......@@ -10,7 +11,8 @@ def aes_decrypt_cbc(data, key, iv):
try:
cipher = AES.new(key.encode(), AES.MODE_CBC, iv.encode())
res = cipher.decrypt(b64decode(data))
res = res.decode('utf-8').replace('\x0e', '').replace('\u0007', '')
# res = res.decode('utf-8').replace('\x0e', '').replace('\u0007', '').replace('\x08', '')
res = re.sub(r'[\x00-\x0f]', '', res.decode('utf-8'))
except Exception as e:
res = ''
return res
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!