Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to extract or unpack an .ab file (Android Backup file) [closed]

I am running an android 4.0.3 device, and I want to extract the back up file created by :

adb backup -f ~/data.ab -noapk app.package.name 

The above line works inside the CMD (windows) and I am able to get the data.ab file inside the '~' directory.

What I can't do is extact that file using CMD . I tried the below two methods.

dd if=data.ab bs=1 skip=24 | openssl zlib -d | tar -xvf -  dd if=data.ab bs=1 skip=24 | python -c "import zlib,sys;sys.stdout.write(zlib.decompress(sys.stdin.read()))" | tar -xvf - 

I get the below error

error

I tried extracting it via CYGWIN, however, I failed too.

error

Where should I do the extraction ? In which directory should my command prompt be ? Any insights ?

like image 377
tony9099 Avatar asked Aug 30 '13 13:08

tony9099


People also ask

How to extract Android backup file easily?

However, as the common users, the first way of extracting Android backup file is really hard. As a result, we share an easy alternative way to backup and restore Android data with Apeaksoft Android Data Backup & Restore. It is the tool, which supports one-click to backup and restore Android files easily.

How to UNTAR a backup file?

Unpack backup. Changes it from an ab to a tar file java -jar abe.jar unpack ~/path/to/backup.ab ~/path/to/backup.tar After thats complete, you can untar it.

How to back up Android device?

If you choose to selectively back up your Android device, select the data type for backup then. Here you can select contacts, messages, call logs, gallery, videos, audio and documents.

Is AB a file-based backup?

It seems this is a file-based backup and unpacking (and repacking) would allow tweaking some internal databases and files without needing to root. I believe the ".ab" format is in some kind of "tar" compressed archive. I believe the ".ab" format is in some kind of "tar" compressed archive. Click to expand... Doesn't look like it.


2 Answers

As per https://android.stackexchange.com/a/78183/239063 you can run a one line command in Linux to add in an appropriate tar header to extract it.

( printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" ; tail -c +25 backup.ab ) |  tar xfvz - 

Replace backup.ab with the path to your file.

like image 192
Puddler Avatar answered Sep 28 '22 20:09

Puddler


I have had to unpack a .ab-file, too and found this post while looking for an answer. My suggested solution is Android Backup Extractor, a free Java tool for Windows, Linux and Mac OS.

Make sure to take a look at the README, if you encounter a problem. You might have to download further files, if your .ab-file is password-protected.

Usage:
java -jar abe.jar [-debug] [-useenv=yourenv] unpack <backup.ab> <backup.tar> [password]

Example:

Let's say, you've got a file test.ab, which is not password-protected, you're using Windows and want the resulting .tar-Archive to be called test.tar. Then your command should be:

java.exe -jar abe.jar unpack test.ab test.tar ""

like image 44
finefoot Avatar answered Sep 28 '22 21:09

finefoot