Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update vbe-decoder.py to fix a utf-8 decoding exception if resulting VB script contains non-ascii chars #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sfunkernw
Copy link

Pullrequest on behalf of by colleague to fix an exception with UTF8 chars in the decoded file:

user@laptop:/$ python3 vbe-decoder.py /vb-file-with-non-ascii-content.vbe
Traceback (most recent call last):
  File "vbe-decoder.py", line 103, in decode_file
    contents :str = handle.read()
  File "/usr/lib/python3.8/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xdc in position 127: invalid continuation byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "vbe-decoder.py", line 141, in <module>
    main()
  File "vbe-decoder.py", line 125, in main
    output :list = decode_files(args.files)
  File "vbe-decoder.py", line 95, in decode_files
    output.append(decode_file(file))
  File "vbe-decoder.py", line 105, in decode_file
    fatal_error(f'{e.message}')
AttributeError: 'UnicodeDecodeError' object has no attribute 'message'

Unfortunately can't provide the original vbe for confidentiality reasons.

Pullrequest on behalf of by colleague to fix an exception with UTF8 chars in the decoded file:

```
user@laptop:/$ python3 vbe-decoder.py /vb-file-with-non-ascii-content.vbe
Traceback (most recent call last):
  File "vbe-decoder.py", line 103, in decode_file
    contents :str = handle.read()
  File "/usr/lib/python3.8/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xdc in position 127: invalid continuation byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "vbe-decoder.py", line 141, in <module>
    main()
  File "vbe-decoder.py", line 125, in main
    output :list = decode_files(args.files)
  File "vbe-decoder.py", line 95, in decode_files
    output.append(decode_file(file))
  File "vbe-decoder.py", line 105, in decode_file
    fatal_error(f'{e.message}')
AttributeError: 'UnicodeDecodeError' object has no attribute 'message'
```

Unfortunately can't provide the original vbe for confidentiality reasons.
@vytenisjakubauskas
Copy link

Same error:

❯ python3 vbe-decoder.py LOI-929901888222-pdf.vbe
Traceback (most recent call last):
File "/Users/vytenis/tmp/vbe-decoder/vbe-decoder.py", line 103, in decode_file
contents :str = handle.read()
^^^^^^^^^^^^^
File "", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/vytenis/tmp/vbe-decoder/vbe-decoder.py", line 141, in
main()
File "/Users/vytenis/tmp/vbe-decoder/vbe-decoder.py", line 125, in main
output :list = decode_files(args.files)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/vytenis/tmp/vbe-decoder/vbe-decoder.py", line 95, in decode_files
output.append(decode_file(file))
^^^^^^^^^^^^^^^^^
File "/Users/vytenis/tmp/vbe-decoder/vbe-decoder.py", line 105, in decode_file
fatal_error(f'{e.message}')
^^^^^^^^^
AttributeError: 'UnicodeDecodeError' object has no attribute 'message'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants