mirror of
https://github.com/scito/extract_otp_secrets.git
synced 2025-12-18 00:00:13 +01:00
fix to_bytes() mandatory byte_order
This commit is contained in:
2
utils.py
2
utils.py
@@ -114,7 +114,7 @@ def replace_escaped_octal_utf8_bytes_with_str(str):
|
|||||||
for encoded_name_string in encoded_name_strings:
|
for encoded_name_string in encoded_name_strings:
|
||||||
escaped_bytes = re.findall(r'((?:\\[0-9]+)+)', encoded_name_string)
|
escaped_bytes = re.findall(r'((?:\\[0-9]+)+)', encoded_name_string)
|
||||||
for byte_sequence in escaped_bytes:
|
for byte_sequence in escaped_bytes:
|
||||||
unicode_str = b''.join([int(byte, 8).to_bytes(1) for byte in byte_sequence.split('\\') if byte]).decode('utf-8')
|
unicode_str = b''.join([int(byte, 8).to_bytes(1, 'little') for byte in byte_sequence.split('\\') if byte]).decode('utf-8')
|
||||||
print("Replace '{}' by '{}'".format(byte_sequence, unicode_str))
|
print("Replace '{}' by '{}'".format(byte_sequence, unicode_str))
|
||||||
str = str.replace(byte_sequence, unicode_str)
|
str = str.replace(byte_sequence, unicode_str)
|
||||||
return str
|
return str
|
||||||
|
|||||||
Reference in New Issue
Block a user