How to extract data from ADB/twrp (.ab) backup? - General Questions and Answers

Hi guys,
i made a backup using ADB and TWRP, no i have a backup.ab that i cant do anything with. I've been searching for a while and i cant unpack, split, or extract the backup. I tried using windows 10, ubuntu bash (on winows10), and virtual linux.
so far, windows and virtual linuxmint 18 give me about the same error.
I used :
Code:
java -jar abe.jar unpack backup1.ab nexus745544.tar
To unpack it, but i get the following error (both windows and linux):
Code:
Invlaid Magic: TWRPtwstreamheaderöâS·TWRPtwfilename€ÌøÔñ£â/data/media/0/TWRP/BACKUPS/0117111846320501/2017-12-17--02-02-18_NRD90MN920PVPS3DQK1/system.ext4.winTWRPtwdatablockDÝíº/app/00407550000000000000000000000062132154162340010533xustar rootroot50 RHT.security.selinux=u:object_r:system_file:s0
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: Invalid Magic TWRPtwstreamheaderöâS·TWRPtwfilename€ÌøÔñ£â/data/media/0/TWRP/BACKUPS/0117111846320501/2017-12-17--02-02-18_NRD90MN920PVPS3DQK1/system.ext4.winTWRPtwdatablockDÝíº/app/00407550000000000000000000000062132154162340010533xustar rootroot50 RHT.security.selinux=u:object_r:system_file:s0
at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:502)
at org.nick.abe.Main.main(Main.java:128)
... 5 more
Caused by: java.lang.IllegalArgumentException: Invalid Magic TWRPtwstreamheaderöâS·TWRPtwfilename€ÌøÔñ£â/data/media/0/TWRP/BACKUPS/0117111846320501/2017-12-17--02-02-18_NRD90MN920PVPS3DQK1/system.ext4.winTWRPtwdatablockDÝíº/app/00407550000000000000000000000062132154162340010533xustar rootroot50 RHT.security.selinux=u:object_r:system_file:s0
at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:332)
... 6 more
other commands i tried:
Code:
dd if=backup1.ab bs=1 skip=24 | python -c "import zlib,sys;sys.stdout.write(zlib.decompress(sys.stdin.read()))" > backup11.tar
This command creates a backup11.tar (with 0 bytes) but the terminal just hangs.
Code:
dd if=backup1.ab bs=24 skip=1|openssl zlib -d > mybackup7668.tar
This command also creates the .tar file with 0 bytes but the terminal throws error:
Code:
openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
which i'm still trying to fix this error, maybe it fixes it.
if you have any more questions, let me know.
Any help is appreciated. Thanks.

Same problem here,
I think TWRP backups are in some way different from others .ab files.

Just wanted to also say I have the exact same problem as the other two people in the thread.
Only, I also have my efs partitions in there and now when I need them my phone is essentially a tablet.

Same problem here. It is hard to believe that the answer to this question is so hard to find. After all, one only needs to be able to read the source code to find the answer (unfortunately, that's not what I am qualified to do)

For anyone else in trouble, more information can be found here:
github.com/TeamWin/Team-Win-Recovery-Project/issues/898

Related

[How to] (SOLVED) Deodex MIUI apps ?

Hi there,
I am trying to deodex LatinIME.odex file from the latest MIUI and having this error :
Code:
UNEXPECTED TOP-LEVEL EXCEPTION:
org.jf.dexlib.Util.ExceptionWithContext: regCount does not match the number of a
rguments of the method
at org.jf.dexlib.Util.ExceptionWithContext.withContext(ExceptionWithCont
ext.java:54)
at org.jf.dexlib.Code.InstructionIterator.IterateInstructions(Instructio
nIterator.java:92)
at org.jf.dexlib.CodeItem.readItem(CodeItem.java:154)
at org.jf.dexlib.Item.readFrom(Item.java:76)
at org.jf.dexlib.OffsettedSection.readItems(OffsettedSection.java:48)
at org.jf.dexlib.Section.readFrom(Section.java:143)
at org.jf.dexlib.DexFile.<init>(DexFile.java:431)
at org.jf.baksmali.main.main(main.java:265)
Caused by: java.lang.RuntimeException: regCount does not match the number of arg
uments of the method
at org.jf.dexlib.Code.Format.Instruction3rc.checkItem(Instruction3rc.jav
a:129)
at org.jf.dexlib.Code.Format.Instruction3rc.<init>(Instruction3rc.java:7
9)
at org.jf.dexlib.Code.Format.Instruction3rc.<init>(Instruction3rc.java:4
4)
at org.jf.dexlib.Code.Format.Instruction3rc$Factory.makeInstruction(Inst
ruction3rc.java:145)
at org.jf.dexlib.Code.InstructionIterator.IterateInstructions(Instructio
nIterator.java:84)
... 6 more
Error occured at code address 0
code_item @0xa90c
I type this cmd line to get that :
java -jar baksmali.jar -d framework -x LatinIME.odex
In the frameworkd folder, I just put all the files found in the \system\framework folder from the ROM.
I don't understand quite well the -c option, maybe I got to play with it, but how ?
Thanks for your help
Ok, I found here that I had to specify an other API Level that de default one (14) set by the baksmali tool.
Whether I don't know what is the API Level for...
Still a newby at this

[Q] [DEV HELP] Baksmali won't load certain classes when using -x option

Hi all,
I am attempting to manually deodex a couple files using smali/baksmali. I've been able to successfully deodex all but 5 apps of a stock ROM. When I try to baksmali any of the 5 apps with this command (I got the bootclasspath from my init.rc):
Code:
baksmali -a 10 -c ../deps/core.jar:../deps/bouncycastle.jar:../deps/ext.jar:../deps/framework.jar:../deps/android.policy.jar:../deps/services.jar:../deps/core-junit.jar:../deps/com.motorola.android.frameworks.jar:../deps/com.motorola.android.widget.jar -x filename.odex
I get:
Code:
Error occured while loading boot class path files. Aborting.
org.jf.dexlib.Code.Analysis.ClassPath$ClassNotFoundException: Could not find interface Landroid/app/ActionBar$OnNavigationListener;
at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.loadAllImplementedInterfaces(ClassPath.java:865)
at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.<init>(ClassPath.java:690)
at org.jf.dexlib.Code.Analysis.ClassPath.loadClassDef(ClassPath.java:280)
at org.jf.dexlib.Code.Analysis.ClassPath.initClassPath(ClassPath.java:163)
at org.jf.dexlib.Code.Analysis.ClassPath.InitializeClassPath(ClassPath.java:131)
at org.jf.baksmali.baksmali.disassembleDexFile(baksmali.java:111)
at org.jf.baksmali.main.main(main.java:293)
Error while loading class Lcom/google/android/maps/driveabout/app/Q; from file ././Maps.zip
Error while loading ClassPath class Lcom/google/android/maps/driveabout/app/Q;
So it seems I just have to add com.google.android.maps.jar to the bootclasspath and it should work, right?
Code:
baksmali -a 10 -c ../deps/core.jar:../deps/bouncycastle.jar:../deps/ext.jar:../deps/framework.jar:../deps/android.policy.jar:../deps/services.jar:../deps/core-junit.jar:../deps/com.motorola.android.frameworks.jar:../deps/com.motorola.android.widget.jar:../deps/com.google.android.maps.jar -x filename.apk
But I get the same exception above. To make sure I added the right jar, I did "baksmali -a 10 com.google.android.maps.jar" and searched for com.google.android.maps.driveabout.app.Q.smali and found nothing. Eventually I discovered that the Maps application holds that class, so...
Code:
baksmali -a 10 -c ../deps/core.jar:../deps/bouncycastle.jar:../deps/ext.jar:../deps/framework.jar:../deps/android.policy.jar:../deps/services.jar:../deps/core-junit.jar:../deps/com.motorola.android.frameworks.jar:../deps/com.motorola.android.widget.jar:Maps.odex -x filename.odex
(since Maps.odex is one of the files that wouldn't deodex) but I STILL got the same error, except the 2nd-to-last line changed to "Error while loading class Lcom/google/android/maps/driveabout/app/Q; from file Maps.odex."
So now I am very confused. I seem to have done it correctly... according to the error, the dependency com.google.android.maps.driveabout.app.Q was missing, so I found out what .odex file held it and then appended it to the bootclasspath and tried again... but to no avail . My phone is a Motorola Atrix 2 running GB 2.3.6. Here is the odexed build that I am attempting to deodex.
Does anyone know what I could be doing wrong? Or if using the -I (ignore) argument would work?
Thanks for any help you can provide.

[Q] Android Studio, Processing, not compiling

I'm having issues either with the IDE Processing and Android Studio.
I'm trying to compile something to Android. But I'm getting this Error at the time of compiling.
Processing IDE:
Code:
-----------------
API<=15: Adding annotations.jar to the classpath.
[echo] ----------
[echo] Building Libraries with 'debug'...
[subant] No sub-builds to iterate on
-code-gen:
Merging AndroidManifest files into one.
Manifest merger disabled. Using project manifest only.
[echo] Handling aidl files...
No AIDL files to compile.
[echo] ----------
[echo] Handling RenderScript files...
No RenderScript files to compile.
[echo] ----------
[echo] Handling Resources...
Generating resource IDs...
[B] BUILD FAILED
/home/user/adt-bundle-linux-x86_64-20130729/sdk/tools/ant/build.xml:649: The following error occurred while executing this line:
/home/user/adt-bundle-linux-x86_64-20130729/sdk/tools/ant/build.xml:690: Execute failed: java.io.IOException: Cannot run program "/home/user/adt-bundle-linux-x86_64-20130729/sdk/build-tools/18.0.1/aapt" (in directory "/tmp/android8933435574063638939sketch"): java.io.IOException: error=2, No such file or directory[/B]
at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
at java.lang.Runtime.exec(Runtime.java:593)
at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:862)
at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:481)
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:495)
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:631)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:672)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:498)
at com.android.ant.AaptExecTask.execute(AaptExecTask.java:699)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
at com.android.ant.IfElseTask.execute(IfElseTask.java:120)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at processing.mode.android.AndroidBuild.antBuild(AndroidBuild.java:415)
at processing.mode.android.AndroidBuild.build(AndroidBuild.java:73)
at processing.mode.android.AndroidMode.handleRunDevice(AndroidMode.java:220)
at processing.mode.android.AndroidEditor$14.run(AndroidEditor.java:310)
Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.<init>(UNIXProcess.java:148)
at java.lang.ProcessImpl.start(ProcessImpl.java:65)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
... 44 more
Total time: 2 seconds
Android Studio:
Code:
[B]Error: Gradle: Execution failed for task':MyApplication2:mergeDebugResources'.
>java.io.IOException: Cannot run program "/home/user/.local/android-studio/sdk/build-tools/android-4.2.2/aapt": error=2, No such file or directory[/B]
The file however is there.
I've installed "adb devices", it seems Ok. I've done all the "51-android.rules" process. I've installed API 10(the one requested) and Android Tools. I don't really know what should be wrong.
But I donnt know what to do.
Could you please give me a hand on this, please? I'm in trouble with this since yesterday morning. I've searched on google with no help.
Edit:
I'm really sorry if this is not the best area to put this topic, but I'm getting desperate right now.

How to extract data from ADB/twrp (.ab) backup?

Hi guys,
i made a backup using ADB and TWRP, now i have a backup.ab that i cant do anything with. I've been searching for a while and i cant unpack, split, or extract the backup. I tried using windows 10, ubuntu bash (on winows10), and virtual linux.
so far, windows and virtual linuxmint 18 give me about the same error.
I used :
Code:
java -jar abe.jar unpack backup.ab backup.tar
To unpack it, but i get the following error (both windows and linux):
Code:
Invlaid Magic: TWRPtwstreamheaderöâS·TWRPtwfilename€ÌøÔñ£â/data/media/0/TWRP/BACKUPS/0117111846320501/2017-12-17--02-02-18_NRD90MN920PVPS3DQK1/system.ext4.winTWRPtwdatablockDÝíº/app/00407550000000000000000000000062132154162340010533xustar rootroot50 RHT.security.selinux=u:object_r:system_file:s0
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: Invalid Magic TWRPtwstreamheaderöâS·TWRPtwfilename€ÌøÔñ£â/data/media/0/TWRP/BACKUPS/0117111846320501/2017-12-17--02-02-18_NRD90MN920PVPS3DQK1/system.ext4.winTWRPtwdatablockDÝíº/app/00407550000000000000000000000062132154162340010533xustar rootroot50 RHT.security.selinux=u:object_r:system_file:s0
at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:502)
at org.nick.abe.Main.main(Main.java:128)
... 5 more
Caused by: java.lang.IllegalArgumentException: Invalid Magic TWRPtwstreamheaderöâS·TWRPtwfilename€ÌøÔñ£â/data/media/0/TWRP/BACKUPS/0117111846320501/2017-12-17--02-02-18_NRD90MN920PVPS3DQK1/system.ext4.winTWRPtwdatablockDÝíº/app/00407550000000000000000000000062132154162340010533xustar rootroot50 RHT.security.selinux=u:object_r:system_file:s0
at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:332)
... 6 more
other commands i tried:
Code:
dd if=backup.ab bs=1 skip=24 | python -c "import zlib,sys;sys.stdout.write(zlib.decompress(sys.stdin.read()))" > backup.tar
This command creates a backup.tar (with 0 bytes) but the terminal just hangs.
Code:
dd if=backup.ab bs=24 skip=1|openssl zlib -d > backup.tar
This command also creates the .tar file with 0 bytes but the terminal throws error:
Code:
140505737033472:error:29065064:lib(41):bio_zlib_read:zlib inflate error:crypto/comp/c_zlib.c:397:zlib error:data error
which i'm still trying to fix this error, maybe it fixes my problem.
if you have any more questions, let me know.
Any help is appreciated. Thanks.

rsync Android / TWRP

I'm trying to create rsync to my andorid / TWRP So i can backup android folder
My code for compile:
Code:
Downloaded from (https://github.com/WayneD/rsync/releases)
./configure --host=arm-linux-gnueabi CFLAGS="-static" --disable-xxhash --disable-zstd
make
make prefix=/home/fredy/Desktop/rsync install
i copy the file ("rsync", "rsync-ssl") into /sbin
But i got this error here and testet with command "rsync":
Code:
/sbin/rsync: line 1: syntax error: unexpected "("
Can you help me out?
Thanks for your time

Categories

Resources