第一次公开测试的结果(还有一些未解决的问题)
This commit is contained in:
@@ -35,9 +35,12 @@ class AESPKCS7:
|
||||
self.iv = iv.encode('utf-8')
|
||||
self.mode = AES.MODE_CBC
|
||||
# 加密
|
||||
def encrypt(self, content: bytes) -> bytes:
|
||||
def encrypt(self, content) -> bytes:
|
||||
# if content is str, convert to bytes
|
||||
if isinstance(content, str):
|
||||
encodedData = content.encode('utf-8')
|
||||
cipher = AES.new(self.key, self.mode, self.iv)
|
||||
content_padded = pad(content, AES.block_size)
|
||||
content_padded = pad(encodedData, AES.block_size)
|
||||
encrypted_bytes = cipher.encrypt(content_padded)
|
||||
return encrypted_bytes
|
||||
# 解密
|
||||
@@ -108,7 +111,7 @@ def apiSDGB(data:str, targetApi:str, userAgentExtraData:str, noLog:bool=False, t
|
||||
logger.warning(f"无法解压,得到的原始响应: {responseRAWContent}")
|
||||
raise SDGBResponseError("解压失败")
|
||||
try:
|
||||
resultResponse = unpad(aes.decrypt(responseDecompressed), 16).decode()
|
||||
resultResponse = aes.decrypt(responseDecompressed)
|
||||
logger.debug(f"成功解密响应!")
|
||||
except:
|
||||
logger.warning(f"解密失败,得到的原始响应: {responseDecompressed}")
|
||||
|
||||
Reference in New Issue
Block a user