Talk:Android Debug Bridge

From ArchWiki
Latest comment: 16 May 2019 by Lacsap in topic adb backup in tgz archive

adb backup in tgz archive

the adb tool is able to make a backup of a smartphone in a file with :

adb backup -all -f mybackup.ab

however, the file has a particular format that prevents it from being used "simply".

to convert it into a tgz archive, it's possible to do this :

( printf "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00"; tail -c +25 mybackup.ab ) > mybackup.tgz

but in this case, you can easily end up with two very large files...

it is also possible to use the following python code:

import socket, sys
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("localhost", 5037))
s.sendall(b"0012host:transport-any")
data = s.recv(4)
s.sendall(b"000ebackup: '-all'")
data = s.recv(4)
data = s.recv(32768)
sys.stdout.buffer.write(b"\x1f\x8b\x08\x00\x00\x00\x00\x00")
data = s.recv(32768)
while data:
    sys.stdout.buffer.write(data)
    data = s.recv(32768)

Lacsap (talk) 09:21, 16 May 2019 (UTC)Reply