Last active
February 13, 2024 05:57
-
-
Save neckothy/6c20a40c37c2d9af6ccc10f94f4c572d to your computer and use it in GitHub Desktop.
Extract keyfile from Kindle for Android on a rooted device/emulator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# https://github.com/noDRM/DeDRM_tools/discussions/440 | |
# REQUIRES ROOTED DEVICE / EMULATOR | |
# get Notifications.pref.xml | |
xml=$(adb shell su -c 'cat /data/data/com.amazon.kindle/shared_prefs/Notifications.pref.xml') | |
# extract dsn from xml | |
dsn=$(echo -n "$xml" | grep -Po '(?<=<string name="serializedDeviceAttributes">{"dsn":")[0-9a-f]{32}') | |
# convert to hexadecimal | |
hex=$(echo -n "$dsn" | od -A n -t x1 | sed 'N;s/[\n ]//g') | |
# output to file | |
echo "{\"DSN\": \"$hex\"}" > './kindle-for-android-key.k4i' | |
# alternatively, as a one-liner | |
# echo "{\"DSN\": \"$(adb shell su -c 'cat /data/data/com.amazon.kindle/shared_prefs/Notifications.pref.xml' | grep -Po '(?<=<string name="serializedDeviceAttributes">{"dsn":")[0-9a-f]{32}' | tr -d '\n' | od -A n -t x1 | sed 'N;s/[\n ]//g')\"}" > kindle-for-android-key.k4i |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment