Last active
December 11, 2018 10:05
-
-
Save testica/179d7b826c21b2547dbfc8d81c2e3e63 to your computer and use it in GitHub Desktop.
Shell script to extract backup files from android application via adb
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 | |
# Script to make and get android application backup (databases-extract purpose) | |
# Use: agentx_get_backup <package_name> | |
# Example: agentx_get_backup com.ltapps.textscanner | |
package_name=$1 | |
echo ">>>>>> Please, accept backup creation (set password when device is encrypted) <<<<<<" | |
# Execute backup create command | |
adb backup -f /var/tmp/backup.ab -noapk $package_name | |
# Execute backup decompress command | |
dd if=/var/tmp/backup.ab bs=24 skip=1 | python -c "import zlib,sys;sys.stdout.write(zlib.decompress(sys.stdin.read()))" > /var/tmp/data.tar | |
# Decompress tar file | |
rm -r $1_backup || true | |
mkdir $1_backup | |
tar xvC $1_backup -f /var/tmp/data.tar 2> /dev/null | |
echo "Backup decompressed in ./$1_backup directory" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Make sure to have adb in your $PATH