Solved I am getting script error unexpected at this time

March 22, 2016 at 05:09:46
Specs: Windows 7
@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.
bin\adb.exe kill-server
bin\adb.exe start-server
bin\adb.exe wait-for-device
bin\adb.exe shell pm path com.whatsapp | bin\grep.exe package > tmp\path.txt
bin\adb.exe shell dumpsys package com.whatsapp | bin\grep.exe versionName > tmp\version.txt
bin\curl.exe -sI http://earth.androidapksfree.com/an... | bin\grep.exe Content-Length > tmp\length.txt
set /p apkflen=<tmp\length.txt
set apkflen=%apkflen:Content-Length: =%
if %apkflen% == 18329558 (
set apkfurl=http://earth.androidapksfree.com/androidbucket/WhatsApp-v2.11.431-AndroidBucket.com.apk
) else (
set apkfurl=http://whatcrypt.com/WhatsApp-2.11.431.apk
)
set /p apkpath=<tmp\path.txt
set apkpath=%apkpath:package:=%
set /p version=<tmp\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 tmp\LegacyWhatsApp.apk (
echo Downloading legacy WhatsApp 2.11.431 to local folder
bin\curl.exe -o tmp\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
bin\adb.exe install -r -d tmp\LegacyWhatsApp.apk
echo Install complete
bin\adb.exe backup -f tmp\whatsapp.ab -noapk com.whatsapp
if exist tmp\whatsapp.ab (
echo.
java -jar bin\abe.jar unpack tmp\whatsapp.ab tmp\whatsapp.tar
bin\tar xvf tmp\whatsapp.tar -C tmp\ apps/com.whatsapp/f/key
bin\tar xvf tmp\whatsapp.tar -C tmp\ apps/com.whatsapp/db/msgstore.db
bin\tar xvf tmp\whatsapp.tar -C tmp\ apps/com.whatsapp/db/wa.db
echo.
echo Extracting whatsapp.key ...
copy tmp\apps\com.whatsapp\f\key extracted\whatsapp.key
echo.
echo Extracting msgstore.db ...
copy tmp\apps\com.whatsapp\db\msgstore.db extracted\msgstore.db
echo.
echo Extracting wa.db ...
copy tmp\apps\com.whatsapp\db\wa.db extracted\wa.db
echo.
echo Pushing cipher key to: /sdcard/WhatsApp/Databases/.nomedia
bin\adb.exe push tmp\apps\com.whatsapp\f\key /sdcard/WhatsApp/Databases/.nomedia
echo.
echo Uploading cipher key to: http://whatcrypt.com/?cmd=_cryptkey
bin\curl.exe -s POST -F "keyfile=@extracted/whatsapp.key" -F "cmd=_uploadkey" http://whatcrypt.com/?cmd=_uploadkey
echo.
echo Cleaning up temporary files ...
echo.
del tmp\whatsapp.ab /s /q
del tmp\whatsapp.tar /s /q
del tmp\length.txt /s /q
del tmp\path.txt /s /q
del tmp\version.txt /s /q
rmdir tmp\apps /s /q
echo.
echo Done
) else (
echo Operation failed
)
echo Restoring WhatsApp %versionName%
bin\adb.exe install -r -d %apkname%
echo Restore complete
echo Removing WhatsApp %versionName% temporary apk
del %apkname% /s /q
) else (
bin\adb.exe backup -f tmp\whatsapp.ab -noapk com.whatsapp
if exist tmp\whatsapp.ab (
echo.
java -jar bin\abe.jar unpack tmp\whatsapp.ab tmp\whatsapp.tar
bin\tar xvf tmp\whatsapp.tar -C tmp\ apps/com.whatsapp/f/key
bin\tar xvf tmp\whatsapp.tar -C tmp\ apps/com.whatsapp/db/msgstore.db
bin\tar xvf tmp\whatsapp.tar -C tmp\ apps/com.whatsapp/db/wa.db
echo.
echo Extracting whatsapp.key ...
copy tmp\apps\com.whatsapp\f\key extracted\whatsapp.key
echo.
echo Extracting msgstore.db ...
copy tmp\apps\com.whatsapp\db\msgstore.db extracted\msgstore.db
echo.
echo Extracting wa.db ...
copy tmp\apps\com.whatsapp\db\wa.db extracted\wa.db
echo.
echo Pushing cipher key to: /sdcard/WhatsApp/Databases/.nomedia
bin\adb.exe push tmp\apps\com.whatsapp\f\key /sdcard/WhatsApp/Databases/.nomedia
echo.
echo Uploading cipher key to: http://whatcrypt.com/?cmd=_cryptkey
bin\curl.exe -s POST -F "keyfile=@extracted/whatsapp.key" -F "cmd=_uploadkey" http://whatcrypt.com/?cmd=_uploadkey
echo.
echo Cleaning up temporary files ...
echo.
del tmp\whatsapp.ab /s /q
del tmp\whatsapp.tar /s /q
del tmp\length.txt /s /q
del tmp\path.txt /s /q
del tmp\version.txt /s /q
rmdir tmp\apps /s /q
echo.
echo Done
) else (
echo Operation failed
)
)
)
set apkpath=
set apkname=
set apkflen=
set apkfurl=
set version=
set versInfo=
set versionName=
bin\adb.exe kill-server
timeout /t 5
exit

See More: I am getting script error unexpected at this time

Report •


#1
March 22, 2016 at 20:02:15
✔ Best Answer
This whole glob:
if exist tmp\whatsapp.ab (
echo.
java -jar bin\abe.jar unpack tmp\whatsapp.ab tmp\whatsapp.tar
bin\tar xvf tmp\whatsapp.tar -C tmp\ apps/com.whatsapp/f/key
bin\tar xvf tmp\whatsapp.tar -C tmp\ apps/com.whatsapp/db/msgstore.db
bin\tar xvf tmp\whatsapp.tar -C tmp\ apps/com.whatsapp/db/wa.db
echo.
echo Extracting whatsapp.key ...
copy tmp\apps\com.whatsapp\f\key extracted\whatsapp.key
echo.
echo Extracting msgstore.db ...
copy tmp\apps\com.whatsapp\db\msgstore.db extracted\msgstore.db
echo.
echo Extracting wa.db ...
copy tmp\apps\com.whatsapp\db\wa.db extracted\wa.db
echo.
echo Pushing cipher key to: /sdcard/WhatsApp/Databases/.nomedia
bin\adb.exe push tmp\apps\com.whatsapp\f\key /sdcard/WhatsApp/Databases/.nomedia
echo.
echo Uploading cipher key to: http://whatcrypt.com/?cmd=_cryptkey
bin\curl.exe -s POST -F "keyfile=@extracted/whatsapp.key" -F "cmd=_uploadkey" http://whatcrypt.com/?cmd=_uploadkey
echo.
echo Cleaning up temporary files ...
echo.
del tmp\whatsapp.ab /s /q
del tmp\whatsapp.tar /s /q
del tmp\length.txt /s /q
del tmp\path.txt /s /q
del tmp\version.txt /s /q
rmdir tmp\apps /s /q
echo.
echo Done

should be a subroutine. Any repetitive code over about half dozen lines should not be duplicated verbatim, because maintenance becomes twice (or more) the burden, and code volume increases. That has no direct relevance to your problem, but it saves time when trying to debug a script.
The other thing to watch out for is using unquoted elements in IF statements, because if one of the elements is undefined, you will get exactly the error you described. For example:
if %versionName% gtr 2.11.431 ...
will fail with "unexpected" if versionname is not defined, whereas:
if "%versionName%" gtr "2.11.431" ...
will allow the script to continue.
I spotted a few other anomalies in your script that might also be spoilers:
for /F "tokens=1" %%k in ("%version%") do (
set %%k
set version=%%v

Where in creation does %%v come from? Your tokens are only set to one (%%k).
and what is %%k? Unless it is something like: "a=b" then set %%k will only do a display of var.s beginning with %%k's value. It won't set anything.

Basic debugging for script: set "pause"s before each major operation and/or code-block, and use "echo" to analyze variable's values at key points. When you run the script, you'll see where it hangs up. If it hangs up between a certain set of pauses, then put more pauses between those to narrow it down. Use "echo" to identify the pause, such as:
echo check point one
pause
hope this helps.

message edited by nbrane


Report •

#2
June 8, 2016 at 07:17:17

Report •

#3
June 19, 2016 at 20:22:06
Whatsapp latest version find here http://safe-apk.com/

message edited by hadi4


Report •

Related Solutions

#4
August 27, 2016 at 10:15:32
You can download older version of whatsapp here: http://www.apkant.com/download/whatsapp-messenger-app-2.16.225-451346.apk

message edited by melisa79


Report •

#5
September 16, 2016 at 05:29:47
Download here Updated version of whatsapp: http://www.apkadsense.com/whatsapp

Report •

Ask Question