-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
Hi John, thanks a lot for this great utility! It help with some phishing email in one incident.
I encountered a UnicodeDecodeError when trying to decode a .vbe file saved in UTF-16LE encoding (which seems to be common for these files).
Here's the traceback: UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xff in position 0
Also, another minor thing: the exception handler uses e.message, which causes: AttributeError: ‘UnicodeDecodeError’ object has no attribute ‘message’
Suggested Fixes
In decode_file(file: str):
try:
handle = open(file, 'r', encoding='utf-8')
contents = handle.read()
except UnicodeDecodeError:
handle = open(file, 'r', encoding='utf-16le')
contents = handle.read()And in main():
- fatal_error(f'{e.message}')
+ fatal_error(str(e))
Let me know if you’d like a PR — happy to help.
Thanks again for your tools!
Best regards,
Stanislav (aka cleverg0d)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels