Skip to content

Instantly share code, notes, and snippets.

@umjammer
Last active November 24, 2023 20:35
Show Gist options
  • Save umjammer/6016be1086477ea94e751049af5a115f to your computer and use it in GitHub Desktop.
Save umjammer/6016be1086477ea94e751049af5a115f to your computer and use it in GitHub Desktop.
[Kindle] DeDRM on MacOS Ventura/Sonoma

DeDRM on MacOS Ventura/Sonoma

we need

  • a emulator image for arm 32bit
  • the old Android Kindle apk
  • adb 1.0.31

A emulator image for arm 32bit

the old kindle doesn't work on arm64 image.

so we need an arm 32bit soft emulator. but newer arm 32bit emulator image doesn't work well.
it's super slow and tends to crash. therefore i choose Jellybean API 16.

even downloading books is slow and sometimes the andoird os freezes (how to restart)
it's pretty good performance. i couldn't stand.
-> using emulator option -gpu host -use-host-vulkan (i don't know if it works)

adb 1.0.31

adb version 1.0.31 is needed for backup kindle on Jellybean API 16 image. (later than 1.0.31 backup doesn't work)

i couldn't find binary 1.0.31 for mac aarch64 except for i386. so i use adb on linux. (thanks for the hint)

i compiled adb by myself using this on Ubuntu aarch64 22.04.2 on UTM

  • that project is for cross compilation, remove cross env like below
index c3cdae1..70e65b8 100755
--- a/adb-download-make.sh
+++ b/adb-download-make.sh
@@ -2,7 +2,7 @@
 # -------------------------
 
 #TODO change to your toolchain path
-source /opt/poky/3.1/environment-setup-aarch64-poky-linux
+#source /opt/poky/3.1/environment-setup-aarch64-poky-linux
 
 # Branch to checkout from Android source code repo
 branch=android-4.4.4_r2.0.1
  • on Ubuntu 22.04.2 compile adb
$ pushd /lib/aarch64-linux-gnu
$ sudo ln -s libcrypto.so.3 libcrypto.so
$ popd
$ LDFLAGS="-L/lib/aarch64-linux-gnu" ./adb-download-make.sh 
  • on UTM (Ubuntu) port forward ssh 22 to 10022

  • on Ventura port forward emulator ports to Ubuntu

$ ssh -NR 5554:localhost:5554 -R 5555:localhost:5555 -l ubuntu_user -p 10022 localhost

Old Android Kindle apk

  • Kindle version 4.16.0.75 for Android
    • install the apk into the device/emulator
    • execute Kindle.app
    • login Amazon and download contents
    • let the android developer mode
    • connect the adb on Ubuntu to the device/emulator (don't forget port forwarding)
    $ adb connect localhost
    connected to localhost:5555
    • backup on Ubuntu like below
    $ adb backup com.amazon.kindle
    • get a file backup.ab

Calibre on Mac

  • set kindle key for android by following steps
  • when u got an error when loading backup.ab
    • get abe.jar from here
    $ java -jar abe.jar unpack backup.ab backup.tar
    0%...100% 
    $ tar xvf backup.tar 
     : 
    x apps/com.amazon.kindle/ef/B0BVM5ZCBR/B0BVM5ZCBR_EBOK.prc: Truncated tar archive
    tar: Error exit delayed from previous errors.
    ^C                                                                       # force to stop
    $ tar cvf backup2.tar apps
    a apps
    a apps/com.amazon.kindle
      :
    $ java -jar ~/Downloads/abe.jar pack backup2.tar backup2.ab 
    ... bytes written to backup2.ab.
    • use backup2.ab instead of backup.ab

Sad news

  • Amazon stops derivering samples to other terminals except Cloud Reader? 🥺
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment