IzzySoft / Adebar

Android DEvice Backup And Report, using Bash and ADB. Moved to https://codeberg.org/izzy/Adebar -- this is only a mirror now.
GNU General Public License v2.0
246 stars 41 forks source link

ab2tar with encrypted? #49

Open auwsom opened 4 years ago

auwsom commented 4 years ago

Hi, lots of good work here, but I just want to look at my adb backup. Whats the quickest way to do that on linux? I've seen some scripts in java or that need perl requirements. I like you solution because its packaged with these. Unfortunately, I get "flate: inflate: data: incorrect header check" when trying to use ab2tar. I assume this is because it is encrypted. As others on SE have similar problems. Any guidance? Thank you

IzzySoft commented 4 years ago

Unfortunately not. By encrypted you mean password-protected backups? Because for "just encrypted", ab2tar should take care (even check which of the two variants it knows of is available – though it might fail if neither is). Always worked fine with mine, but I'm never on the "bleeding edge" version of Android (but usually at least one or two behind)…

Hm, incorrect header check could also mean the .ab format was changed. If you look inside the file with a plain ASCII viewer, what do the first 4 lines are look like? Example:

ANDROID BACKUP
4
1
none
auwsom commented 4 years ago

Hi Izzy, thanks for the reply. There is another user on AE of SE who also happens to be trying to extract an ab file today. It seems like only the Java solution can handle the password protection. I told him I'm trying your app, and would report back. (https://android.stackexchange.com/questions/28481/how-do-you-extract-an-apps-data-from-a-full-backup-made-through-adb-backup). Most Google android phones are encrypted with password by default since several years ago, and I believe most will be soon.

I will look at the header..

auwsom commented 4 years ago
ANDROID BACKUP
4
1
AES-256
auwsom commented 4 years ago

Hi Izzy, thanks for the reply.. but, I think I got it.. using nelenkov's app (https://github.com/nelenkov/android-backup-extractor) and instructions here: https://forum.xda-developers.com/showthread.php?t=2011811. I was trying to avoid the extra 800mb disk space for Java, but I think its the only solution that works with encrypted.

IzzySoft commented 4 years ago

I didn't know that the phone being encrypted implies the backup is, too. OK, so that's an AES-256 encrypted backup. Did it need a password or not? If not, there should be a way, and probably one additional step might be needed before calling zlib-deflate (decrypting) – or some additional parameter to openssl (well, decrypting). I once tried that abe.jar in the past and was not convinced – but that might be due to the fact I never encountered an encrypted backup and thus never saw reason to that overkill.

Could you try adding the aes256 parameter to the openssl call and see if that helps? It might also need the -k "password" one, I never tried (and neither manpage nor info-page give a clue on this). I currently have no time to dig into that unfortunately, but if you can figure something I gladly pick it up. Just found some PHP examples which might be worth looking at – but still no complete syntax for the openssl command at the shell…