use newer version of sqlcipher

This commit is contained in:
ppwwyyxx
2015-11-03 15:17:56 -05:00
parent ffcfa9237a
commit 13e3d456e8
2 changed files with 5 additions and 50 deletions
+5 -5
View File
@@ -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
-45
View File
@@ -1,45 +0,0 @@
#!/bin/bash -e
# File: decrypt-db.sh
# Date: Tue Jun 16 22:23:13 2015 +0800
# Author: Yuxin Wu <[email protected]>
source compatibility.sh
MSGDB=$1
imei=$2
uin=$3
output=decoded.db
if [[ -z "$1" || -z "$2" || -z "$3" ]]; then
echo "Usage: $0 <path to EnMicroMsg.db> <imei> <uin>"
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"