Alter.Org.UA
 << Back Home UK uk   Donate Donate

Android .adb extraction

The most of android phones allow data backup in debug mode. You should enable it first. Steps may be different among devices. Xiomi Mi 5/4/3 (e.g. Redmi 5). See also general manual for Android. You have to install adb. Make sure that USB file transfer is enabled when connecting device to PC. On the first connection Android will prompt you to confirm debugging. Also, you must confirm Backup procedure every time. Each .adb file has 24-byte header (see details ). Assume that file is not encrypted. In this case we should just replace .adb header with proper .tgz header. Script below connects to the phone and downloads all data from internal storage to .tgz archive (without SD-card -noshared and app images -noapk).

android-backup.bash

#!/bin/bash
adb usb
sleep 5
mkdir android
cd android
a=`adb devices -l|grep "no perm"`
case "x$a" in
  "x")
    # ok
    ;;
  *)
    echo Please activate file transfer over USB and authorize if necessary
    exit
    ;;  
esac
a=`adb devices -l|grep -v "List of"`
case "x$a" in
  "x")
    echo Please connect device
    exit
    ;;  
esac
adb backup -noapk -noshared -all -f backup-file.adb
if [ ! -s backup-file.adb ] ; then
  echo backup aborted
  exit
fi
printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" > backup-file.tgz
#dd if=backup-file.adb bs=24 skip=1 >> backup-file.tgz # its too slow
tail -c +25 backup-file.adb >> backup-file.tgz
#tar -zxf backup-file.tgz
Download abkp.bash

If you already has .adb, this would be enough

printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" > backup-file.tgz
tail -c +25 backup-file.adb >> backup-file.tgz
2018.12.30


FB or mail alterX@alter.org.ua (remove X)   Share
designed by Alter aka Alexander A. Telyatnikov powered by Apache+PHP under FBSD © 2002-2024