Skip to content

Instantly share code, notes, and snippets.

@yan-foto
Last active Feb 17, 2021
Embed
What would you like to do?
DeDRM Adobe Digital Edition Books
Convenient DeDRM Scripts
-------------------------
**NOTE**: read https://blog.quaintous.com/2021/02/16/remove-drm-from-ebooks/ to find out what this gist is good for.
* ./init.sh: extracts Adobe Digital Editions private key and required files to DeDRM.
* ./dedrm: removes DRM from given ebook (pdf/epub)
If you are using this for the first time, make sure that you have authenticated your Adobe Digital Editions (ADE) and run './init.sh'. Import any DRM-protected file into ADE and run 'dedrm.sh':
./dedrm.sh /PATH/TO/EBOOK
It uses the already extracted private key under "config/adobekey.der" and two python scripts (for epub and pdf extensions respectively) which were originally part of the DeDRM Calibre plugins:
https://github.com/apprenticeharper/DeDRM_tools
The jailbroken ebook is now in the root directory!
#!/bin/bash
err () {
>&2 echo "$1"
exit 1
}
main() {
local readonly KEY="./conf/adobekey.der"
if [[ ! -r "${KEY}" ]]; then
err "Private Adobe Key not found!"
fi
local readonly LIB="./lib"
if [[ ! -d "${LIB}" ]]; then
err "DeDRM python scripts not found!"
fi
if [[ ! -r "$1" ]]; then
err "No file given to DeDRM!"
fi
local readonly FILENAME="$(basename -- "$1")"
local readonly EXT="${FILENAME##*.}"
local libTarget="${LIB}/inept${EXT}.py"
python3 "${libTarget}" "${KEY}" "$1" "${FILENAME}"
}
main "$@" || exit 1
#!/bin/bash
set -e
main() {
local readonly LIBPATH="$(pwd)/lib"
local readonly CONFPATH="$(pwd)/conf"
mkdir -p "${LIBPATH}"
mkdir -p "${CONFPATH}"
local winePrefix="${WINEPREFIX}"
if [[ -z "${winePrefix}" ]]; then
echo "WINEPREFIX not given, using defualt ('~/.ade')..."
export WINEPREFIX=~/.ade
fi
echo "Downloading necessary scripts..."
wget --continue -i "sources.txt" -P "${LIBPATH}"
echo "Trying to extract Adobe private Key..."
local readonly KEYPATH="${CONFPATH}/adobekey.der"
if [[ -r "${KEYPATH}" ]]; then
echo "Private key found under '${CONFPATH}'".
else
wine python "${LIBPATH}/adobekey.py" "${CONFPATH}/adobekey.der"
fi
}
main "$@" || exit 1
https://raw.githubusercontent.com/apprenticeharper/DeDRM_tools/v6.8.1/DeDRM_plugin/adobekey.py
https://raw.githubusercontent.com/apprenticeharper/DeDRM_tools/v6.8.1/DeDRM_plugin/ineptpdf.py
https://raw.githubusercontent.com/apprenticeharper/DeDRM_tools/v6.8.1/DeDRM_plugin/ineptepub.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment