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

Crypto replace required on some(?) systems #12

Open
0x0000beef opened this issue Jan 13, 2023 · 2 comments
Open

Crypto replace required on some(?) systems #12

0x0000beef opened this issue Jan 13, 2023 · 2 comments

Comments

@0x0000beef
Copy link

0x0000beef commented Jan 13, 2023

As a user of Linux Mint and python 3.10.6...

Kernel: 5.15.0-56-generic x86_64 bits: 64 compiler: gcc v: 11.3.0 Desktop: Xfce 4.16.0
    tk: Gtk 3.24.23 wm: xfwm dm: LightDM Distro: Linux Mint 21.1 Vera base: Ubuntu 22.04 jammy

...I came across a problem in using the script:

Traceback (most recent call last):
  File "/home/.../bookmate_downloader/src/python3/bookmate_downloader.py", line 249, in <module>
    book.download()
  File "/home/.../bookmate_downloader/src/python3/bookmate_downloader.py", line 133, in download
    metadata = self.decrypt_metadata(encrypted_metadata, self.secret)
  File "/home/.../bookmate_downloader/src/python3/bookmate_downloader.py", line 148, in decrypt_metadata
    metadata[key] = self.decrypt(secret, bytess(val))
  File "/home/.../bookmate_downloader/src/python3/bookmate_downloader.py", line 156, in decrypt
    bts = self.rawDecryptBytes(data[16:], key, data[:16])
  File "/home/.../bookmate_downloader/src/python3/bookmate_downloader.py", line 166, in rawDecryptBytes
    cipher = AES.new(key, AES.MODE_CBC, iv)
  File "/home/.../.local/lib/python3.10/site-packages/Crypto/Cipher/AES.py", line 95, in new
    return AESCipher(key, *args, **kwargs)
  File "/home/.../.local/lib/python3.10/site-packages/Crypto/Cipher/AES.py", line 59, in __init__
    blockalgo.BlockAlgo.__init__(self, _AES, key, *args, **kwargs)
  File "/home/.../.local/lib/python3.10/site-packages/Crypto/Cipher/blockalgo.py", line 141, in __init__
    self._cipher = factory.new(key, *args, **kwargs)
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

This SO answer helped me: https://stackoverflow.com/a/73713926

pip uninstall pycrypto
pip install pycryptodome

requirements короче надо обновить наверное. Или дополнить описание.

@Vonsaum
Copy link

Vonsaum commented Feb 13, 2023

How did you manage to find the BMS cookie? I don't have one. Maybe it's because bookmate became part of Yandex services.

@0x0000beef
Copy link
Author

If I understand correctly, the BMS cookie is given differently for different browsers - the right one can be pulled from chrome-like browsers, not from firefox (Brave in my case). Yes, Bookmate is now part of Ya, but for non-russian ip everything works as before (at least it did a couple of weeks ago)

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

No branches or pull requests

2 participants