0.0.1
This commit is contained in:
@@ -14,15 +14,19 @@ class NavicatPassword:
|
|||||||
cipher = AES.new(self.aes_key, AES.MODE_CBC, self.aes_iv)
|
cipher = AES.new(self.aes_key, AES.MODE_CBC, self.aes_iv)
|
||||||
decrypted = cipher.decrypt(data)
|
decrypted = cipher.decrypt(data)
|
||||||
# 处理填充字符和不可打印字符
|
# 处理填充字符和不可打印字符
|
||||||
# 仅去除常见的填充字符
|
# 去除填充字符和控制字符
|
||||||
decrypted = decrypted.rstrip(b'\x00\x03\x04\x05')
|
decrypted = decrypted.rstrip(b'\x00\x03\x04\x05')
|
||||||
|
|
||||||
# 直接尝试解码,不进行任何字符过滤
|
# 过滤掉控制字符(0x00-0x1F),保留可打印字符
|
||||||
|
decrypted = bytes(b for b in decrypted if b >= 32 or b == 9 or b == 10 or b == 13)
|
||||||
|
|
||||||
|
# 尝试多种编码方式
|
||||||
encodings = ['utf-8', 'latin1', 'cp1252', 'gbk', 'big5']
|
encodings = ['utf-8', 'latin1', 'cp1252', 'gbk', 'big5']
|
||||||
for encoding in encodings:
|
for encoding in encodings:
|
||||||
try:
|
try:
|
||||||
# 直接返回解码结果,保留所有字符
|
decoded = decrypted.decode(encoding)
|
||||||
return decrypted.decode(encoding)
|
# 保留所有可打印字符
|
||||||
|
return decoded
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
continue
|
continue
|
||||||
# 最后尝试,替换无法解码的字符
|
# 最后尝试,替换无法解码的字符
|
||||||
|
|||||||
Reference in New Issue
Block a user