Skip to content
/ abpy Public

backup.ab to tar and tar to backup.ab converter python3 script

License

Notifications You must be signed in to change notification settings

xBZZZZ/abpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

about adb backup

adb backup and adb restore are obscure (not mentioned in adb --help) and depracated features of adb but no root needed

adb backup and adb restore commands documented here

file generated by adb backup is optionally compressed, optinally encrypted tar (pax (kinda) format (don't confuse with pax command)) container

files and pax headers in tar archive need to be be in secific order and have specific names, so extracting and creating archive probably won't work (adb restore silently fails)

you can update files in tar archive without extracting everything using 7zz (7-Zip for Linux: console version) u command

here is help for old version of 7z.exe but most command line options are same as 7zz

abpy.py is python3 script for files generated by adb backup

abpy.py depends on pycryptodome if using pbkdf2engine=pycryptodome or aes256engine=pycryptodome

abpy.py depends on pycryptodomex if using pbkdf2engine=pycryptodomex or aes256engine=pycryptodomex

example: modify /data/data/com.gdpsedi.geometrydashsubzero/CCLocalLevels.dat on android no root using linux computer

  1. backup com.gdpsedi.geometrydashsubzero's files into backup.ab:
    $ adb backup com.gdpsedi.geometrydashsubzero
    WARNING: adb backup is deprecated and may be removed in a future release
  2. convert backup.ab to backup.tar:
    $ python3 abpy.py ab2tar if=backup.ab of=backup.tar
  3. find CCLocalLevels.dat path in list of files in backup.tar:
    $ 7zz l backup.tar | grep -F CCLocalLevels.dat
    2023-04-13 11:11:51 .....          733         1024  apps/com.gdpsedi.geometrydashsubzero/r/CCLocalLevels.dat
  4. extract with full path apps/com.gdpsedi.geometrydashsubzero/r/CCLocalLevels.dat from backup.tar:
    $ 7zz x backup.tar apps/com.gdpsedi.geometrydashsubzero/r/CCLocalLevels.dat
    
    7-Zip (z) 22.01 (x64) : Copyright (c) 1999-2022 Igor Pavlov : 2022-07-15
     64-bit locale=en_US.UTF-8 Threads:12, ASM
    
    Scanning the drive for archives:
    1 file, 6880256 bytes (6719 KiB)
    
    Extracting archive: backup.tar
    --
    Path = backup.tar
    Type = tar
    Physical Size = 6880256
    Headers Size = 14336
    Code Page = UTF-8
    Characteristics = POSIX PREFIX PAX path ASCII
    
    Everything is Ok
    
    Size:       733
    Compressed: 6880256
  5. edit apps/com.gdpsedi.geometrydashsubzero/r/CCLocalLevels.dat
  6. update apps/com.gdpsedi.geometrydashsubzero/r/CCLocalLevels.dat to backup.tar:
    $ 7zz u backup.tar apps/com.gdpsedi.geometrydashsubzero/r/CCLocalLevels.dat
    
    7-Zip (z) 22.01 (x64) : Copyright (c) 1999-2022 Igor Pavlov : 2022-07-15
     64-bit locale=en_US.UTF-8 Threads:12, ASM
    
    Open archive: backup.tar
    --
    Path = backup.tar
    Type = tar
    Physical Size = 6880256
    Headers Size = 14336
    Code Page = UTF-8
    Characteristics = POSIX PREFIX PAX path ASCII
    
    Scanning the drive:
    1 file, 824 bytes (1 KiB)
    
    Updating archive: backup.tar
    
    Keep old data in archive: 6 folders, 17 files, 6861172 bytes (6701 KiB)
    Add new data to archive: 1 file, 824 bytes (1 KiB)
    
        
    Files read from disk: 1
    Archive size: 6880256 bytes (6719 KiB)
    Everything is Ok
  7. get info about backup.ab:
    $ python3 abpy.py abinfo if=backup.ab
    ver=5
    compr
  8. convert backup.tar to backup.ab with that info:
    $ python3 abpy.py tar2ab if=backup.tar of=backup.ab compr ver=5
  9. restore the new backup.ab:
    $ adb restore backup.ab
    WARNING: adb restore is deprecated and may be removed in a future release
    Now unlock your device and confirm the restore operation.

stuff I found related to adb backup

About

backup.ab to tar and tar to backup.ab converter python3 script

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages