Leseratte10 / acsm-calibre-plugin

Calibre plugin for ACSM->EPUB and ACSM->PDF conversion.
https://www.mobileread.com/forums/showthread.php?t=341975
GNU General Public License v3.0
695 stars 24 forks source link

ERROR: Unhandled exception: <b>InvalidPlugin</b> #73

Closed Drjacky closed 11 months ago

Drjacky commented 11 months ago

Bug description

calibre, version 7.1.0 ERROR: Unhandled exception: InvalidPlugin:Initialization of plugin Traceback (most recent call last): File "calibre/customize/ui.py", line 710, in initialize_plugin File "calibre_plugins.deacsm.init", line 288, in initialize from libadobe import createDeviceKeyFile, update_account_path, sendHTTPRequest ModuleNotFoundError: No module named 'libadobe' failed with traceback: Traceback (most recent call last): File "calibre/customize/ui.py", line 710, in initialize_plugin File "calibre_plugins.deacsm.init", line 288, in initialize from libadobe import createDeviceKeyFile, update_account_path, sendHTTPRequest ModuleNotFoundError: No module named 'libadobe'

calibre 7.1 embedded-python: True macOS-14.1.2-arm64-arm-64bit Darwin ('64bit', '') ('Darwin', '23.1.0', 'Darwin Kernel Version 23.1.0: Mon Oct 9 21:28:45 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T6020') Python 3.11.5 OSX: ('14.1.2', ('', '', ''), 'arm64') Interface language: None Successfully initialized third party plugins: DeDRM (10, 0, 9) && Obok DeDRM (10, 0, 9) && ACSM Input Plugin GUI Extension (0, 1, 0) Traceback (most recent call last): File "calibre/customize/ui.py", line 710, in initialize_plugin File "calibre_plugins.deacsm.init", line 288, in initialize from libadobe import createDeviceKeyFile, update_account_path, sendHTTPRequest ModuleNotFoundError: No module named 'libadobe'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "calibre/gui2/preferences/plugins.py", line 325, in add_plugin File "calibre/customize/ui.py", line 520, in add_plugin File "calibre/customize/ui.py", line 715, in initialize_plugin calibre.customize.InvalidPlugin: Initialization of plugin Traceback (most recent call last): File "calibre/customize/ui.py", line 710, in initialize_plugin File "calibre_plugins.deacsm.init", line 288, in initialize from libadobe import createDeviceKeyFile, update_account_path, sendHTTPRequest ModuleNotFoundError: No module named 'libadobe' failed with traceback: Traceback (most recent call last): File "calibre/customize/ui.py", line 710, in initialize_plugin File "calibre_plugins.deacsm.init", line 288, in initialize from libadobe import createDeviceKeyFile, update_account_path, sendHTTPRequest ModuleNotFoundError: No module named 'libadobe'

Operating system

MacOS

Which version of Calibre are you running?

7.1

Which version of the ACSM Input plugin are you running?

DeACSM v0.0.16

Import type

No response

Further information

And this is the log for running calibre sh:

➜  acsm-calibre-plugin-master ./bundle_calibre_plugin.sh
~/Toolz/PDF/acsm-calibre-plugin-master/calibre-plugin ~/Toolz/PDF/acsm-calibre-plugin-master
--2023-12-03 11:54:28--  https://github.com/Leseratte10/acsm-calibre-plugin/releases/download/config/asn1crypto_1.5.1.zip
Resolving github.com (github.com)... 140.82.121.3
Connecting to github.com (github.com)|140.82.121.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/408145724/9faee370-d172-4e6e-815b-6a71d51fffcf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20231203%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20231203T115428Z&X-Amz-Expires=300&X-Amz-Signature=e813eafc050b233170d4f7a666db14df34fd3ba4985ca64292f6d0beba5069d1&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=408145724&response-content-disposition=attachment%3B%20filename%3Dasn1crypto_1.5.1.zip&response-content-type=application%2Foctet-stream [following]
--2023-12-03 11:54:28--  https://objects.githubusercontent.com/github-production-release-asset-2e65be/408145724/9faee370-d172-4e6e-815b-6a71d51fffcf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20231203%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20231203T115428Z&X-Amz-Expires=300&X-Amz-Signature=e813eafc050b233170d4f7a666db14df34fd3ba4985ca64292f6d0beba5069d1&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=408145724&response-content-disposition=attachment%3B%20filename%3Dasn1crypto_1.5.1.zip&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.108.133, 185.199.110.133, 185.199.109.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.108.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 137386 (134K) [application/octet-stream]
Saving to: ‘asn1crypto.zip’

asn1crypto.zip      100%[===================>] 134.17K  --.-KB/s    in 0.04s

2023-12-03 11:54:29 (2.91 MB/s) - ‘asn1crypto.zip’ saved [137386/137386]

--2023-12-03 11:54:29--  https://github.com/Leseratte10/acsm-calibre-plugin/releases/download/config/oscrypto_1.3.0_fork_fe39273cc5020_new.zip
Resolving github.com (github.com)... 140.82.121.3
Connecting to github.com (github.com)|140.82.121.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/408145724/e6d3ab3c-5fb1-4cdd-a3da-42901f5dc12d?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20231203%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20231203T115429Z&X-Amz-Expires=300&X-Amz-Signature=2360bda6538e8307e097ae6a8c31be3c1c4f578a6aa4ea06c09c122d6715ecfd&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=408145724&response-content-disposition=attachment%3B%20filename%3Doscrypto_1.3.0_fork_fe39273cc5020_new.zip&response-content-type=application%2Foctet-stream [following]
--2023-12-03 11:54:29--  https://objects.githubusercontent.com/github-production-release-asset-2e65be/408145724/e6d3ab3c-5fb1-4cdd-a3da-42901f5dc12d?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20231203%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20231203T115429Z&X-Amz-Expires=300&X-Amz-Signature=2360bda6538e8307e097ae6a8c31be3c1c4f578a6aa4ea06c09c122d6715ecfd&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=408145724&response-content-disposition=attachment%3B%20filename%3Doscrypto_1.3.0_fork_fe39273cc5020_new.zip&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.108.133, 185.199.110.133, 185.199.109.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.108.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 221458 (216K) [application/octet-stream]
Saving to: ‘oscrypto.zip’

oscrypto.zip        100%[===================>] 216.27K  --.-KB/s    in 0.06s

2023-12-03 11:54:29 (3.50 MB/s) - ‘oscrypto.zip’ saved [221458/221458]

~/Toolz/PDF/acsm-calibre-plugin-master
~/Toolz/PDF/acsm-calibre-plugin-master/calibre-plugin-tmp ~/Toolz/PDF/acsm-calibre-plugin-master
~/Toolz/PDF/acsm-calibre-plugin-master/calibre-plugin-tmp/keyextract ~/Toolz/PDF/acsm-calibre-plugin-master/calibre-plugin-tmp ~/Toolz/PDF/acsm-calibre-plugin-master
i686-w64-mingw32-gcc main.c -Os -o decrypt_win32.exe -lcrypt32 -lwsock32
make: i686-w64-mingw32-gcc: No such file or directory
make: *** [decrypt_win32.exe] Error 1
base64: invalid argument decrypt_win32.exe
Usage:  base64 [-Ddh] [-b num] [-i in_file] [-o out_file]
  -b, --break    break encoded string into num character lines
  -Dd, --decode   decodes input
  -h, --help     display this message
  -i, --input    input file (default: "-" for stdin)
  -o, --output   output file (default: "-" for stdout)
base64: invalid argument decrypt_win64.exe
Usage:  base64 [-Ddh] [-b num] [-i in_file] [-o out_file]
  -b, --break    break encoded string into num character lines
  -Dd, --decode   decodes input
  -h, --help     display this message
  -i, --input    input file (default: "-" for stdin)
  -o, --output   output file (default: "-" for stdout)
sed: -i: No such file or directory

'''
Copyright (c) 2021-2023 Leseratte10
This file is part of the ACSM Input Plugin by Leseratte10
ACSM Input Plugin for Calibre / acsm-calibre-plugin

For more information, see:
https://github.com/Leseratte10/acsm-calibre-plugin
'''

# NOTE:
# This file contains the two Windows executables "decrypt_win32.exe" and "decrypt_win64.exe"
# in base64-encoded form. The source code for these files can be found inside the main.c file
# in the "keyextract" directory. It's only ~200 lines of harmless C source code.

# These two programs are used only for Linux-based OSes, in order to run them in a WINE
# environment to extract ADE account data from an ADE instance running in WINE.

# Because these programs are decrypting data that belongs to another program (account data
# from ADE), various antivirus programs might detect them as malicious and try to block the
# plugin. As these executables aren't needed on Windows and MacOS (only on Linux), they
# are included here in obfuscated form and are only extracted when on Linux. This should make
# antivirus programs shut up and stop reporting this plugin as a virus.

import base64

def get_win32_data():
    return base64.b64decode(data_win32)

def get_win64_data():
    return base64.b64decode(data_win64)

data_win32 = """
"""

data_win64 = """
@@@CALIBRE_DECRYPTOR_WIN64_B64@@@
"""
sed: -i: No such file or directory

'''
Copyright (c) 2021-2023 Leseratte10
This file is part of the ACSM Input Plugin by Leseratte10
ACSM Input Plugin for Calibre / acsm-calibre-plugin

For more information, see:
https://github.com/Leseratte10/acsm-calibre-plugin
'''

# NOTE:
# This file contains the two Windows executables "decrypt_win32.exe" and "decrypt_win64.exe"
# in base64-encoded form. The source code for these files can be found inside the main.c file
# in the "keyextract" directory. It's only ~200 lines of harmless C source code.

# These two programs are used only for Linux-based OSes, in order to run them in a WINE
# environment to extract ADE account data from an ADE instance running in WINE.

# Because these programs are decrypting data that belongs to another program (account data
# from ADE), various antivirus programs might detect them as malicious and try to block the
# plugin. As these executables aren't needed on Windows and MacOS (only on Linux), they
# are included here in obfuscated form and are only extracted when on Linux. This should make
# antivirus programs shut up and stop reporting this plugin as a virus.

import base64

def get_win32_data():
    return base64.b64decode(data_win32)

def get_win64_data():
    return base64.b64decode(data_win64)

data_win32 = """
@@@CALIBRE_DECRYPTOR_WIN32_B64@@@
"""

data_win64 = """
"""
rm: decrypt_win32.exe: No such file or directory
rm: decrypt_win64.exe: No such file or directory
~/Toolz/PDF/acsm-calibre-plugin-master/calibre-plugin-tmp ~/Toolz/PDF/acsm-calibre-plugin-master
rm: __pycache__: No such file or directory
rm: *.pyc: No such file or directory
./bundle_calibre_plugin.sh: line 54: shopt: globstar: invalid shell option name
Injecting Python2 compat code ...
sed: -i: No such file or directory
sed: **/*.py: No such file or directory
  adding: LICENSE (deflated 66%)
  adding: README.md (deflated 60%)
  adding: __calibre_compat_code.py (deflated 47%)
  adding: __init__.py (deflated 71%)
  adding: acsm_logo_2.png (deflated 2%)
  adding: asn1crypto.zip (stored 0%)
  adding: config.py (deflated 82%)
  adding: cpuid.py (deflated 70%)
  adding: customRSA.py (deflated 63%)
  adding: exportPluginAuthToWindowsADE.py (deflated 67%)
  adding: fulfill.py (deflated 66%)
  adding: getEncryptionKeyLinux.py (deflated 63%)
  adding: getEncryptionKeyWindows.py (deflated 68%)
  adding: get_key_from_Adobe.py (deflated 60%)
  adding: gui_main.py (deflated 65%)
  adding: gui_main_wrapper.py (deflated 53%)
  adding: keyextract/ (stored 0%)
  adding: keyextract/Makefile (deflated 59%)
  adding: keyextract/main.c (deflated 65%)
  adding: keyextractDecryptor.py (deflated 49%)
  adding: libadobe.py (deflated 68%)
  adding: libadobeAccount.py (deflated 80%)
  adding: libadobeFulfill.py (deflated 79%)
  adding: libadobeImportAccount.py (deflated 72%)
  adding: libpdf.py (deflated 71%)
  adding: module_id.txt (stored 0%)
  adding: oscrypto.zip (stored 0%)
  adding: plugin-import-name-deacsm.txt (stored 0%)
  adding: prefs.py (deflated 70%)
  adding: register_ADE_account.py (deflated 61%)
  adding: singleinstance_helper.py (deflated 62%)
Leseratte10 commented 11 months ago

Thanks for the report. This is the same bug as #72 so I'm closing this one. Haven't had that much time to look into the issue, sadly.