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

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.

Related

Please Help!

I have been trying to figure out how to sign an apk I have for the droid x. Actually it's a lot of apks but im using this one as an example. I have deodexed the apks and now want to resign them to put back onto my droid. From what I understand, after unzipping and apk and rebuilding it, you need to resign it before it can be used. If this is different for the droid x I am unaware.
Here is what I am running
here is my java version
Code:
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)
here is the command with testsign.jar
Code:
java -classpath testsign.jar AccountAndSyncSettings.apk AccountAndSyncSettings-signed.apk
with the error
Code:
Could not find the main class: AccountAndSyncSettings.apk
and when using
Code:
java -classpath testsign.jar AccountAndSyncSettings.apk AccountAndSyncSettings-signed.apk
I get
Code:
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:114)
at java.util.jar.JarFile.<init>(JarFile.java:135)
at java.util.jar.JarFile.<init>(JarFile.java:114)
at testsign.main(testsign.java:361)
also tried with signapk.jar
Code:
java -jar -classpath ~/deodex/sources/sign/signapk.jar ~/deodex/sources/sign/testkey.x509.pem key.pk8 AccountAndSyncSettings.apk AccountAndSyncSetting-signed.apk
and get
Code:
Invalid or corrupt jarfile /home/andrew/deodex/sources/sign/testkey.x509.pem
another signapk.jar variation
Code:
java -jar ~/deodex/sources/sign/signapk.jar ~/deodex/sources/sign/testkey.x509.pem ~/deodex/sources/sign/testkey.pk8 AccountAndSyncSettings.apk AccountAndSyncSetting-signed.apk
and get
Code:
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:114)
at java.util.jar.JarFile.<init>(JarFile.java:135)
at java.util.jar.JarFile.<init>(JarFile.java:114)
at com.android.signapk.SignApk.main(SignApk.java:320)
last one I promise
Code:
java -classpath ~/deodex/sources/sign/signapk.jar ~/deodex/sources/sign/testkey.x509.pem ~/deodex/sources/sign/testkey.pk8 AccountAndSyncSettings.apk AccountAndSyncSetting-signed.apk
and lastly I get
Code:
Caused by: java.lang.ClassNotFoundException: .home.andrew.deodex.sources.sign.testkey.x509.pem
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: /home/andrew/deodex/sources/sign/testkey.x509.pem
Please Help!!!!

[Q] Signing in debug mode

I'm trying to use command line tools to develop an Android app. I'm calling aapt as follows:
"C:\Program Files (x86)\Android\android-sdk\platform-tools\aapt.exe" package -f --debug-mode -M C:\MyProjects\MyAndroidProject\AndroidManifest.xml -S C:\MyProjects\MyAndroidProject\res -I "C:\Program Files (x86)\Android\android-sdk\platforms\android-9\android.jar" -F C:\MyProjects\MyAndroidProject\bin\MyActivity-debug-unaligned.apk
I assume that, because I've specified --debug-mode, aapt will attach a debug certificate, making my app runnable on an emulator. But I keep getting the message
Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]
How can I diagnose the problem?

[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

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

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

[SOLVED] [HELP] Can't install bsdiff4 and use .bin Payload Dumper

Yo hello, i installed a custom rom for my motorola one (deen), and i need to root it again with magisk. But the rom has a .bin file instead of normal boot.img stuff. So i got this Payload dumper, but it doesn't want to work. Everytime i try to install the dependencies it says
C:\Users\nego ney\Downloads\payload_dumper-master\payload_dumper-master>python3 -m pip install -r requirements.txt
Requirement already satisfied: protobuf==3.6.0 in c:\users\nego ney\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from -r requirements.txt (line 1)) (3.6.0)
Requirement already satisfied: six==1.11.0 in c:\users\nego ney\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from -r requirements.txt (line 2)) (1.11.0)
Collecting bsdiff4>=1.1.5
Using cached bsdiff4-1.2.1.tar.gz (11 kB)
Requirement already satisfied: setuptools in c:\program files\windowsapps\pythonsoftwarefoundation.python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\site-packages (from protobuf==3.6.0->-r requirements.txt (line 1)) (56.0.0)
Using legacy 'setup.py install' for bsdiff4, since package 'wheel' is not installed.
Installing collected packages: bsdiff4
Running setup.py install for bsdiff4 ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\nego ney\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\nego ney\\AppData\\Local\\Temp\\pip-install-mp5zoj50\\bsdiff4_b64f4fb7c8d44c99a8989c37191075a4\\setup.py'"'"'; __file__='"'"'C:\\Users\\nego ney\\AppData\\Local\\Temp\\pip-install-mp5zoj50\\bsdiff4_b64f4fb7c8d44c99a8989c37191075a4\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\nego ney\AppData\Local\Temp\pip-record-tk6s6_pk\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\nego ney\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Include\bsdiff4'
cwd: C:\Users\nego ney\AppData\Local\Temp\pip-install-mp5zoj50\bsdiff4_b64f4fb7c8d44c99a8989c37191075a4\
Complete output (19 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\bsdiff4
copying bsdiff4\cli.py -> build\lib.win-amd64-3.9\bsdiff4
copying bsdiff4\format.py -> build\lib.win-amd64-3.9\bsdiff4
copying bsdiff4\test_all.py -> build\lib.win-amd64-3.9\bsdiff4
copying bsdiff4\__init__.py -> build\lib.win-amd64-3.9\bsdiff4
running build_ext
building 'bsdiff4.core' extension
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\Release
creating build\temp.win-amd64-3.9\Release\bsdiff4
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\include -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um /Tcbsdiff4/core.c /Fobuild\temp.win-amd64-3.9\Release\bsdiff4/core.obj
core.c
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\include\pyconfig.h(59): fatal error C1083: Nao ‚ poss¡vel abrir arquivo incluir: 'io.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\nego ney\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\nego ney\\AppData\\Local\\Temp\\pip-install-mp5zoj50\\bsdiff4_b64f4fb7c8d44c99a8989c37191075a4\\setup.py'"'"'; __file__='"'"'C:\\Users\\nego ney\\AppData\\Local\\Temp\\pip-install-mp5zoj50\\bsdiff4_b64f4fb7c8d44c99a8989c37191075a4\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\nego ney\AppData\Local\Temp\pip-record-tk6s6_pk\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\nego ney\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Include\bsdiff4' Check the logs for full command output
"
"
And i could not find any tutorial solving that, please help me bois
help reeeeeee
please answer me i beg
bump
Solved, i used it on a vm running clean python + vs instalations, sorry for useless thread
iHatePayloadDumper said:
Solved, i used it on a vm running clean python + vs instalations, sorry for useless thread
Click to expand...
Click to collapse
hey, how did u solved that problem? im stuck here too
Larry112 said:
hey, how did u solved that problem? im stuck here too
Click to expand...
Click to collapse
Had the same issue. Downgrading protobuf to 3.19.3 fixed it for me

Categories

Resources