Skip to content

Instantly share code, notes, and snippets.

@ilmotta
Created February 24, 2025 12:31
Show Gist options
  • Select an option

  • Save ilmotta/596317ced5d49b3b8b91cdc8043fd80e to your computer and use it in GitHub Desktop.

Select an option

Save ilmotta/596317ced5d49b3b8b91cdc8043fd80e to your computer and use it in GitHub Desktop.
Copy Status mobile app protected data folder in rooted devices using adb
#! /usr/bin/env bash
set -euo pipefail
build="$1"
plain_text_password="$2"
# Get device ID with "adb devices"
device="$3"
adb -s "$device" root
timestamp=$(date +"%Y%m%dT%H%M%S")
out_dir="no_backup-${timestamp}"
build_path="${build:+.${build}}"
adb -s "$device" pull -a "/data/user/0/im.status.ethereum${build_path}/no_backup" "${out_dir}"
cd "${out_dir}"
hashed_password=$(nix-shell -p python311Packages.eth-hash python311Packages.pycryptodome --pure --run "python3 -c 'from eth_hash.auto import keccak; print(keccak(b\"${plain_text_password}\").hex())'")
password="0x${hashed_password}"
# Clear the file if it exists or create it fresh.
true > ".env"
if [ -d keystore ]; then
# Loop through each directory in keystore
for dir in $(find keystore -mindepth 1 -maxdepth 1 -type d -print0 | xargs --null basename); do
cat <<EOF >> ".env"
${dir}-v4.db = ${password}
${dir}-v4.db_kdfIter = 3200
${dir}-v4.db_hmacAlgorithm = SHA1
${dir}-v4.db_kdfAlgorithm = SHA1
${dir}-v4.db_pageSize = 8192
${dir}-v4.db_plaintextHeaderSize = 0
${dir}-wallet.db = ${password}
${dir}-wallet.db_kdfIter = 3200
${dir}-wallet.db_hmacAlgorithm = SHA1
${dir}-wallet.db_kdfAlgorithm = SHA1
${dir}-wallet.db_pageSize = 8192
${dir}-wallet.db_plaintextHeaderSize = 0
EOF
done
fi
echo "Data directory successfully backed up."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment