[GH-ISSUE #120] [bug] [since #2ae18b1] Decryption of non-msgstore files crashes #55

Closed
opened 2026-03-02 03:59:44 +03:00 by kerem · 2 comments
Owner

Originally created by @gchem1se on GitHub (Apr 27, 2024).
Original GitHub issue: https://github.com/ElDavoo/wa-crypt-tools/issues/120

Originally assigned to: @gchem1se on GitHub.

I noticed wadecrypt crashes when the issued file is not a msgstore (eg. I'm decrypting wa.db.cryptXX or stickers.db.cryptXX).
I found the cause is trivial, a logging line in a utils module, in the header_info function, which tries to print the maximum feature number of the msgstore file, even if the provided input is not a msgstore.
I might create a PR, but it's really a one-line solution.
utils.py:180:

string += str("Max feature number: {}\n".format(max(features)))

Everything works again after commenting it out or adding a check.

Complete traceback:

File "venv/bin/wadecrypt", line 8, in <module>
    sys.exit(main())
  File "venv/lib/python3.10/site-packages/wa_crypt_tools/wadecrypt.py", line 237, in main
    db = DatabaseFactory.from_file(args.encrypted)
  File "venv/lib/python3.10/site-packages/wa_crypt_tools/lib/db/dbfactory.py", line 128, in from_file
    l.debug(header_info(header))
  File "venv/lib/python3.10/site-packages/wa_crypt_tools/lib/utils.py", line 180, in header_info
    string += str("Max feature number: {}\n".format(max(features)))
ValueError: max() arg is an empty sequence
Originally created by @gchem1se on GitHub (Apr 27, 2024). Original GitHub issue: https://github.com/ElDavoo/wa-crypt-tools/issues/120 Originally assigned to: @gchem1se on GitHub. I noticed `wadecrypt` crashes when the issued file is not a msgstore (eg. I'm decrypting `wa.db.cryptXX` or `stickers.db.cryptXX`). I found the cause is trivial, a logging line in a [utils module](https://github.com/ElDavoo/wa-crypt-tools/commit/2ae18b1eff63227832cfa28c2b5cbf154ec0e508), in the `header_info` function, which tries to print the maximum feature number of the msgstore file, even if the provided input is not a msgstore. I might create a PR, but it's really a one-line solution. `utils.py:180`: ```py string += str("Max feature number: {}\n".format(max(features))) ``` Everything works again after commenting it out or adding a check. Complete traceback: ```py File "venv/bin/wadecrypt", line 8, in <module> sys.exit(main()) File "venv/lib/python3.10/site-packages/wa_crypt_tools/wadecrypt.py", line 237, in main db = DatabaseFactory.from_file(args.encrypted) File "venv/lib/python3.10/site-packages/wa_crypt_tools/lib/db/dbfactory.py", line 128, in from_file l.debug(header_info(header)) File "venv/lib/python3.10/site-packages/wa_crypt_tools/lib/utils.py", line 180, in header_info string += str("Max feature number: {}\n".format(max(features))) ValueError: max() arg is an empty sequence ```
kerem 2026-03-02 03:59:44 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@ElDavoo commented on GitHub (Apr 27, 2024):

Yep, the new version was a little bit rushed out and the number of things that can happen is exploding.
Congrats for the on-point and precise debug and thanks for the PR! I will merge it when it's ready (i saw you closed it)

<!-- gh-comment-id:2081125291 --> @ElDavoo commented on GitHub (Apr 27, 2024): Yep, the new version was a little bit rushed out and the number of things that can happen is exploding. Congrats for the on-point and precise debug and thanks for the PR! I will merge it when it's ready (i saw you closed it)
Author
Owner

@gchem1se commented on GitHub (Apr 27, 2024):

I closed it 'cause even if it was a one-line solution, I still managed to forget a newline ._. eheh. Should be fine now.
Keep up the good work!

<!-- gh-comment-id:2081135077 --> @gchem1se commented on GitHub (Apr 27, 2024): I closed it 'cause even if it was a one-line solution, I still managed to forget a newline ._. eheh. Should be fine now. Keep up the good work!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/wa-crypt-tools#55
No description provided.