[Android Apps and Games] dyxsyntax2016:
I fixxed some thing in your code for some reasson the folder structure doesnt work and adb from the bin folder wasnt executed correctly

during the backup it creates a mess in the root folder but the files get still deleted afterwards

cause its my first post at xda i had to delete all the links inside the BBcode maybe some can repost with full permission

here the code for the .bat file:

@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
color 0a
title WhatsApp Key/DB Extractor 1.6 (Official)
echo =========================================================================
echo = This script will extract the WhatsApp Key file and DB on Android 4.0+ =
echo = You DO NOT need root for this to work but you DO need Java installed. =
echo = If your WhatsApp version is greater than 2.11.431 (most likely), then =
echo = a legacy version will be installed temporarily in order to get backup =
echo = permissions. You will NOT lose ANY data and your current version will =
echo = be restored at the end of the extraction process so try not to panic. =
echo = A copy of your crypt key will also be uploaded to the whatcrypt site, =
echo = for your convenience and to aid their developers in cracking crypt8.. =
echo = Script by: TripCode (Greets to all who visit: XDA Developers Forums). =
echo = Thanks to: dragomerlin for ABE and to Abinash Bishoyi for being cool. =
echo = ### Version: v1.6 (10/04/2015) ### =
echo =========================================================================
echo.
echo Please connect your Android device with USB Debugging enabled:
echo.
adb kill-server
adb start-server
adb wait-for-device
adb shell pm path com.whatsapp | bin\grep.exe package > path.txt
adb shell dumpsys package com.whatsapp | bin\grep.exe versionName > version.txt
bin\curl.exe -sI //earth.androida.431-AndroidBucket.com.apk | bin\grep.exe Content-Length > length.txt
set /p apkflen=<length.txt
set apkflen=%apkflen:Content-Length: =%
if %apkflen% == 18329558 (
set apkfurl=//earth.androidapksfree.com/androidbucket/WhatsApp-v2.11.431-AndroidBucket.com.apk
) else (
set apkfurl=//whatcrypt.com/WhatsApp-2.11.431.apk
)
set /p apkpath=<path.txt
set apkpath=%apkpath:package:=%
set /p version=<version.txt
for %%A in ("%apkpath%") do (
set apkname=%%~nxA
)
:nextVar
for /F "tokens=1" %%k in ("%version%") do (
set %%k
set version=%%v
)
for %%A in (path.txt) do if %%~zA==0 (
set apkpath=
echo WhatsApp is not installed on the target device
echo.
echo Exiting ...
) else (
echo WhatsApp %versionName% installed
if %versionName% gtr 2.11.431 (
if not exist LegacyWhatsApp.apk (
echo Downloading legacy WhatsApp 2.11.431 to local folder
bin\curl.exe -o LegacyWhatsApp.apk %apkfurl%
) else (
echo Found legacy WhatsApp 2.11.431 in local folder
)
echo Backing up WhatsApp %versionName%
bin\adb pull %apkpath%
echo Backup complete
echo Installing legacy WhatsApp 2.11.431
adb install -r -d LegacyWhatsApp.apk
echo Install complete
adb backup -f whatsapp.ab -noapk com.whatsapp
if exist whatsapp.ab (
echo.
java -jar bin\abe.jar unpack whatsapp.ab whatsapp.tar
bin\tar xvf whatsapp.tar apps/com.whatsapp/f/key
bin\tar xvf whatsapp.tar apps/com.whatsapp/db/msgstore.db
bin\tar xvf whatsapp.tar apps/com.whatsapp/db/wa.db
echo.
echo Extracting whatsapp.key ...
copy apps\com.whatsapp\f\key extracted\whatsapp.key
echo.
echo Extracting msgstore.db ...
copy apps\com.whatsapp\db\msgstore.db extracted\msgstore.db
echo.
echo Extracting wa.db ...
copy apps\com.whatsapp\db\wa.db extracted\wa.db
echo.
echo Pushing cipher key to: /sdcard/WhatsApp/Databases/.nomedia
adb push apps\com.whatsapp\f\key /sdcard/WhatsApp/Databases/.nomedia
echo.
echo Uploading cipher key to: //whatcrypt.com/?cmd=_cryptkey
bin\curl.exe -s POST -F "keyfile=@extracted/whatsapp.key" -F "cmd=_uploadkey" //whatcrypt.com/?cmd=_uploadkey
echo.
echo Cleaning up temporary files ...
echo.
del whatsapp.ab /s /q
del whatsapp.tar /s /q
del length.txt /s /q
del path.txt /s /q
del version.txt /s /q
rmdir apps /s /q
echo.
echo Done
) else (
echo Operation failed
)
echo Restoring WhatsApp %versionName%
adb install -r -d %apkname%
echo Restore complete
echo Removing WhatsApp %versionName% temporary apk
del %apkname% /s /q
) else (
adb backup -f whatsapp.ab -noapk com.whatsapp
if exist whatsapp.ab (
echo.
java -jar bin\abe.jar unpack whatsapp.ab whatsapp.tar
bin\tar xvf whatsapp.tar apps/com.whatsapp/f/key
bin\tar xvf whatsapp.tar apps/com.whatsapp/db/msgstore.db
bin\tar xvf whatsapp.tar apps/com.whatsapp/db/wa.db
echo.
echo Extracting whatsapp.key ...
copy apps/com.whatsapp\f\key extracted\whatsapp.key
echo.
echo Extracting msgstore.db ...
copy apps/com.whatsapp\db\msgstore.db extracted\msgstore.db
echo.
echo Extracting wa.db ...
copy apps/com.whatsapp\db\wa.db extracted\wa.db
echo.
echo Pushing cipher key to: /sdcard/WhatsApp/Databases/.nomedia
adb push com.whatsapp\f\key /sdcard/WhatsApp/Databases/.nomedia
echo.
echo Uploading cipher key to: //whatcrypt.com/?cmd=_cryptkey
bin\curl.exe -s POST -F "keyfile=@extracted/whatsapp.key" -F "cmd=_uploadkey" //whatcrypt.com/?cmd=_uploadkey
echo.
echo Cleaning up temporary files ...
echo.
del whatsapp.ab /s /q
del whatsapp.tar /s /q
del length.txt /s /q
del path.txt /s /q
del version.txt /s /q
rmdir apps /s /q
echo.
echo Done
) else (
echo Operation failed
)
)
)
set apkpath=
set apkname=
set apkflen=
set apkfurl=
set version=
set versInfo=
set versionName=
adb kill-server
pause