[Android Apps and Games] jobhimself:
After resolving a few errors by installing everything required, trying with many WhatsApp versions, on OSX, Linux and Windows, I still can't get the script to work.

There is no error per se but the script seems unable to find the needed directories (look after I entered the backup password).

My phone is a BlackPhone BP1.

=========================================================================
= This script will extract the WhatsApp Key file and DB on Android 4.0+ =
= You DO NOT need root for this to work but you DO need Java installed. =
= If your WhatsApp version is greater than 2.11.431 (most likely), then =
= a legacy version will be installed temporarily in order to get backup =
= permissions. You will NOT lose ANY data and your current version will =
= be restored at the end of the extraction process so try not to panic. =
= Script by: TripCode (Greets to all who visit: XDA Developers Forums). =
= Thanks to: dragomerlin for ABE and to Abinash Bishoyi for being cool. =
= ### Version: v4.7 (12/10/2016) ### =
=========================================================================

Please connect your Android device with USB Debugging enabled:

* server not running *
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
./WhatsAppKeyDBExtract.sh: line 57: [: -eq: unary operator expected

Found legacy WhatsApp 2.11.431 in local folder

WhatsApp 2.12.25 installed

Backing up WhatsApp 2.12.25
[100%] /data/app/com.whatsapp-1.apk
Backup complete

Installing legacy WhatsApp 2.11.431
[100%] /data/local/tmp/LegacyWhatsApp.apk
pkg: /data/local/tmp/LegacyWhatsApp.apk
Success
Install complete

Now unlock your device and confirm the backup operation...

Please enter your backup password (leave blank for none) and press Enter:
******
tar: apps/com.whatsapp/f/key: Not found in archive
tar: Error exit delayed from previous errors.
tar: apps/com.whatsapp/db/msgstore.db: Not found in archive
tar: Error exit delayed from previous errors.
tar: apps/com.whatsapp/db/wa.db: Not found in archive
tar: Error exit delayed from previous errors.
tar: apps/com.whatsapp/db/axolotl.db: Not found in archive
tar: Error exit delayed from previous errors.
tar: apps/com.whatsapp/db/chatsettings.db: Not found in archive
tar: Error exit delayed from previous errors.

Saving whatsapp.cryptkey ...
cp: tmp/apps/com.whatsapp/f/key: No such file or directory
Saving msgstore.db ...
cp: tmp/apps/com.whatsapp/db/msgstore.db: No such file or directory
Saving wa.db ...
cp: tmp/apps/com.whatsapp/db/wa.db: No such file or directory
Saving axolotl.db ...
cp: tmp/apps/com.whatsapp/db/axolotl.db: No such file or directory
Saving chatsettings.db ...
cp: tmp/apps/com.whatsapp/db/chatsettings.db: No such file or directory

Pushing cipher key to: /storage/emulated/legacy/WhatsApp/Databases/.nomedia
adb: error: cannot stat 'tmp/apps/com.whatsapp/f/key': No such file or directory

Restoring WhatsApp 2.12.25
[100%] /data/local/tmp/com.whatsapp-1.apk
pkg: /data/local/tmp/com.whatsapp-1.apk
Success
Restore complete

Cleaning up temporary files ...
Done

Operation complete

Please press Enter to quit...

How can I get the script to work?

EDIT

The error seems to occur at line 32:

java -jar bin/abe.jar unpack tmp/whatsapp.ab tmp/whatsapp.tar $password

If I don't rm the tmp files and execute this line I have:

% java -jar ../bin/abe.jar unpack whatsapp.ab whatsapp.tar PASSWORD
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.RuntimeException: javax.crypto.BadPaddingException: Given final block not properly padded
at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:420)
at org.nick.abe.Main.main(Main.java:128)
... 5 more
Caused by: javax.crypto.BadPaddingException: Given final block not properly padded
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:966)
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:824)
at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:436)
at javax.crypto.Cipher.doFinal(Cipher.java:2165)
at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:330)
... 6 more