Talk:Android Debug Bridge

From ArchWiki
Jump to navigation Jump to search

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))
data = s.recv(4)
s.sendall(b"000ebackup: '-all'")
data = s.recv(4)
data = s.recv(32768)
data = s.recv(32768)
while data:
    data = s.recv(32768)

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