Closed YuvrajRaghuvanshiS closed 3 years ago
This issue occurs only when backup is created using adb over tcp.
@nelenkov You're the only person I can think of who has enough experience with ADB backup, can you help me with what's going on here?
PS : whatsapp.ab header are correct. Here's how I'm doing it if you're curious.
.
.
.
if(os.path.isfile(tmp + 'whatsapp.ab')):
CustomPrint('Found whatsapp.ab in tmp folder. Continuing... Size : ' +
str(os.path.getsize(tmp + '/whatsapp.ab')) + ' bytes.')
userName = CustomInput(
'Enter a reference name for this user. : ') or 'user'
abPass = CustomInput(
'Enter same password which you entered on device when prompted earlier. : ')
try:
os.system('java -jar ' + bin + 'abe.jar unpack ' + tmp +
'whatsapp.ab ' + tmp + 'whatsapp.tar ' + str(abPass))
CustomPrint('Successfully \'fluffed\' ' + tmp + 'whatsapp.ab to ' + tmp +
'whatsapp.tar. Size : ' + str(os.path.getsize(tmp + 'whatsapp.tar')) + ' bytes.')
TakingOutMainFiles(userName, sdPath, ADBSerialId)
def TakingOutMainFiles(userName, sdPath, ADBSerialId):
os.mkdir(extracted) if not (os.path.isdir(extracted)) else CustomPrint(
'Folder ' + extracted + ' already exists.', 'yellow')
os.mkdir(extracted + userName) if not (os.path.isdir(extracted + userName)
) else CustomPrint('Folder ' + extracted + userName + ' already exists.', 'yellow')
CustomPrint('Taking out main files in ' + tmp + ' folder temporaily.')
try:
bin = '' if(isLinux) else 'bin\\'
os.system(bin + tar + ' xvf ' + tmp + 'whatsapp.tar -C ' +
tmp + ' apps/com.whatsapp/f/key')
os.replace('tmp/apps/com.whatsapp/f/key',
extracted + userName + '/key')
os.system(bin + tar + ' xvf ' + tmp + 'whatsapp.tar -C ' +
tmp + ' apps/com.whatsapp/db/msgstore.db')
os.replace('tmp/apps/com.whatsapp/db/msgstore.db',
extracted + userName + '/msgstore.db')
os.system(bin + tar + ' xvf ' + tmp + 'whatsapp.tar -C ' +
tmp + ' apps/com.whatsapp/db/wa.db')
os.replace('tmp/apps/com.whatsapp/db/wa.db',
extracted + userName + '/wa.db')
os.system(bin + tar + ' xvf ' + tmp + 'whatsapp.tar -C ' +
tmp + ' apps/com.whatsapp/db/axolotl.db')
os.replace('tmp/apps/com.whatsapp/db/axolotl.db',
extracted + userName + '/axolotl.db')
os.system(bin + tar + ' xvf ' + tmp + 'whatsapp.tar -C ' +
tmp + ' apps/com.whatsapp/db/chatsettings.db')
os.replace('tmp/apps/com.whatsapp/db/chatsettings.db',
extracted + userName + '/chatsettings.db')
CleanTmp()
CustomPrint(
'You should not leave these extracted database and other files hanging in folder, it is very insecure.')
.
.
.
Instead of using adb backup
using adb shell "bu backup com.whatsapp ^> /sdcard/whatsapp.ab"
seems to solve this.
echo -e "\nYou can backup using 'adb backup' command (option A)\n"
echo -e "or you can use 'bu' command and then 'adb pull' (option B) (need enough storage on sdcard)\n"
read -n1 -p "Please select an option? [A,B]" backup_option
if [[ $input == "A" || $input == "a" ]]; then
if [ $sdkver -ge 23 ]; then
adb backup -f tmp/whatsapp.ab com.whatsapp
else
adb backup -f tmp/whatsapp.ab -noapk com.whatsapp
fi
elif [[ $input == "B" || $input == "b" ]]; then
if [ $sdkver -ge 28 ]; then
echo -e "Android 9.0 or higher\n"
adb shell "bu backup com.whatsapp ^> /sdcard/whatsapp.ab"
adb pull /sdcard/whatsapp.ab tmp/whatsapp.ab
elif [ $sdkver -ge 23 ]; then
echo -e "Android 6 to 8.1\n"
adb shell "bu 1 backup com.whatsapp ^> /sdcard/whatsapp.ab"
adb pull /sdcard/whatsapp.ab tmp/whatsapp.ab
else
echo -e "Android before 6\n"
adb shell "bu 1 backup -noapk com.whatsapp ^> /sdcard/whatsapp.ab"
adb pull /sdcard/whatsapp.ab tmp/whatsapp.ab
fi
else
echo -e "Sorry, unsupported option\n"
fi
adb v1.0.41 on TCP also avoids this issue.
Looks like a bug in adb then? Maybe depends on file size? In any case, glad it's resolved.
Can't say if depends on file size, I believe creating backup and sharing it over TCP at the same time calls for it. Whatever the case is I'm also glad it is solved.
Describe the bug bin\tar.exe: Unexpected EOF on archive file.
To Reproduce Steps to reproduce the behavior:
. See error
Expected behavior Extract files.
Screenshots![image](https://user-images.githubusercontent.com/52948878/108514923-7d000880-72ea-11eb-8f63-d980dbc90d30.png)
Terminal output
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context Add any other context about the problem here.