如何提取或解压缩一个.ab 文件(Android 备份文件)

我正在运行一个 android 4.0.3设备,我想提取备份文件创建的:

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

上面这行代码在 CMD (windows)中工作,我能够在’~’目录中获取 data.ab 文件。

我不能做的是使用 CMD 提取该文件。

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 -

我得到了下面的错误

error

我试过从 CYGWIN 提取但也失败了。

error

我应该在哪里进行提取? 我的命令提示应该在哪个目录中? 有什么见解吗?

172760 次浏览

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 ""

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.