From 13e3d456e86e3bb1c12ed2a3942fe8c2db0ad158 Mon Sep 17 00:00:00 2001 From: ppwwyyxx Date: Tue, 3 Nov 2015 15:16:27 -0500 Subject: [PATCH] use newer version of sqlcipher --- android-interact.sh | 10 +++++----- decrypt-db.sh | 45 --------------------------------------------- 2 files changed, 5 insertions(+), 50 deletions(-) delete mode 100755 decrypt-db.sh diff --git a/android-interact.sh b/android-interact.sh index 335283d..fc4867a 100755 --- a/android-interact.sh +++ b/android-interact.sh @@ -18,7 +18,7 @@ adb root if [[ $1 == "uin" ]]; then adb pull $MM_DIR/shared_prefs/system_config_prefs.xml 2>/dev/null - uin=$(grep 'default_uin' system_config_prefs.xml | $GREP -o 'value="[0-9]*' | cut -c 8-) + uin=$($GREP 'default_uin' system_config_prefs.xml | $GREP -o 'value="-\?[0-9]*' | cut -c 8-) [[ -n $uin ]] || { >&2 echo "Failed to get wechat uin. You can try other methods, or report a bug." exit 1 @@ -26,7 +26,7 @@ if [[ $1 == "uin" ]]; then rm system_config_prefs.xml echo "Got wechat uin: $uin" elif [[ $1 == "imei" ]]; then - imei=$(adb shell dumpsys iphonesubinfo | grep 'Device ID' | $GREP -o '[0-9]\+') + imei=$(adb shell dumpsys iphonesubinfo | $GREP 'Device ID' | $GREP -o '[0-9]\+') [[ -n $imei ]] || { >&2 echo "Failed to get imei. You can try other methods, or report a bug." exit 1 @@ -78,9 +78,9 @@ elif [[ $1 == "db" || $1 == "res" ]]; then fi elif [[ $1 == "db-decrypt" ]]; then echo "Getting uin..." - $0 uin | tail -n1 | grep -o '[0-9]*' | tee /tmp/uin + $0 uin | tail -n1 | $GREP -o '-\?[0-9]*' | tee /tmp/uin echo "Getting imei..." - $0 imei | tail -n1 | grep -o '[0-9]*' | tee /tmp/imei + $0 imei | tail -n1 | $GREP -o '[0-9]*' | tee /tmp/imei echo "Getting db..." $0 db echo "Decrypting db..." @@ -90,7 +90,7 @@ elif [[ $1 == "db-decrypt" ]]; then >&2 echo "Failed to get imei or uin. See README for manual methods." exit 1 fi - ./decrypt-db.sh EnMicroMsg.db $imei $uin + ./decrypt-db.py EnMicroMsg.db $imei $uin rm /tmp/{uin,imei} echo "Done. See decoded.db" else diff --git a/decrypt-db.sh b/decrypt-db.sh deleted file mode 100755 index e773b1a..0000000 --- a/decrypt-db.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -e -# File: decrypt-db.sh -# Date: Tue Jun 16 22:23:13 2015 +0800 -# Author: Yuxin Wu - -source compatibility.sh - -MSGDB=$1 -imei=$2 -uin=$3 -output=decoded.db - -if [[ -z "$1" || -z "$2" || -z "$3" ]]; then - echo "Usage: $0 " - exit 1 -fi - -if [[ -f $output ]]; then - echo -n "$output already exists. removed? (y/n)" - read r - [[ $r == "y" ]] && rm -v $output || exit 1 -fi - - -KEY=$(echo -n "$imei$uin" | $MD5SUM | cut -b 1-7) -echo "KEY: $KEY" - -uname | grep Darwin > /dev/null && os=darwin || os=linux -uname -m | grep x86_64 > /dev/null && version=64bit || version=32bit -echo "Use $version sqlcipher of $os." - -echo "Dump decoded database... (Don't worry about libcrypt.so version warning.)" - - -SQLCIPHER=./third-party/sqlcipher/$os/$version -export LD_LIBRARY_PATH=$SQLCIPHER -"$SQLCIPHER"/sqlcipher "$MSGDB" << EOF -PRAGMA key='$KEY'; -PRAGMA cipher_use_hmac = off; -ATTACH DATABASE "$output" AS db KEY ""; -SELECT sqlcipher_export("db"); -DETACH DATABASE db; -EOF - -echo "Database successfully dumped to $output"