sqlcipher compatibilty
This commit is contained in:
@@ -27,7 +27,7 @@ If it doesn't work, please leave an issue together with your phone/OS/wechat ver
|
||||
+ python-PIL
|
||||
+ [PyQuery](https://pypi.python.org/pypi/pyquery/1.2.1)
|
||||
+ [pysox](https://pypi.python.org/pypi/pysox/0.3.6.alpha) and sox
|
||||
+ [pysqlcipher](https://pypi.python.org/pypi/pysqlcipher)
|
||||
+ [sqlcipher](https://github.com/sqlcipher/sqlcipher) >= 4.1 and [pysqlcipher](https://pypi.python.org/pypi/pysqlcipher)
|
||||
+ numpy
|
||||
+ csscompressor (suggested, optional)
|
||||
+ adb and rooted android phone connected to a Linux/Mac OSX/Win10+Bash.
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ elif [[ $1 == "db" || $1 == "res" ]]; then
|
||||
echo "Pulling resources... "
|
||||
for d in avatar image2 voice2 emoji video sfs; do
|
||||
adb shell "cd $RES_DIR/$chooseUser &&
|
||||
busybox tar czf - $d 2>/dev/null | busybox base64" |
|
||||
tar czf - $d 2>/dev/null | base64" |
|
||||
base64 -di | tar xzf -
|
||||
|
||||
# Old Slow Way:
|
||||
|
||||
+2
-3
@@ -47,9 +47,8 @@ if __name__ == '__main__':
|
||||
conn = sqlite.connect(args.db)
|
||||
c = conn.cursor()
|
||||
c.execute("PRAGMA key = '" + key + "';")
|
||||
c.execute("PRAGMA cipher_use_hmac = OFF;")
|
||||
c.execute("PRAGMA cipher_page_size = 1024;")
|
||||
c.execute("PRAGMA kdf_iter = 4000;")
|
||||
# https://github.com/sqlcipher/sqlcipher/commit/e4b66d6cc8a2b7547a32ff2c3ac52f148eba3516
|
||||
c.execute("PRAGMA cipher_compatibility = 1;")
|
||||
c.execute("ATTACH DATABASE '" + args.output + "' AS db KEY '';")
|
||||
c.execute("SELECT sqlcipher_export('db');" )
|
||||
c.execute("DETACH DATABASE db;" )
|
||||
|
||||
+3
-1
@@ -49,6 +49,8 @@ if __name__ == '__main__':
|
||||
with open(output_file, 'w') as f:
|
||||
print >> f, htmls[0].encode('utf-8')
|
||||
else:
|
||||
assert output_file.endswith(".html")
|
||||
basename = output_file[:-5]
|
||||
for idx, html in enumerate(htmls):
|
||||
with open(output_file + '.{}'.format(idx), 'w') as f:
|
||||
with open(basename + '.{}'.format(idx) + '.html', 'w') as f:
|
||||
print >> f, html.encode('utf-8')
|
||||
|
||||
+4
-14
@@ -1,7 +1,6 @@
|
||||
#!/bin/bash -e
|
||||
# File: decrypt-db.sh
|
||||
# Date: Tue Jun 16 22:23:13 2015 +0800
|
||||
# Author: Yuxin Wu
|
||||
|
||||
source compatibility.sh
|
||||
|
||||
@@ -21,24 +20,15 @@ if [[ -f $output ]]; then
|
||||
[[ $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 decrypted database... "
|
||||
|
||||
echo "Dump decrypted database... (Don't worry about libcrypt.so version warning.)"
|
||||
|
||||
|
||||
SQLCIPHER=./sqlcipher/$os/$version
|
||||
export LD_LIBRARY_PATH=$SQLCIPHER
|
||||
"$SQLCIPHER"/sqlcipher "$MSGDB" << EOF
|
||||
# https://github.com/sqlcipher/sqlcipher/commit/e4b66d6cc8a2b7547a32ff2c3ac52f148eba3516
|
||||
sqlcipher "$MSGDB" << EOF
|
||||
PRAGMA key='$KEY';
|
||||
PRAGMA cipher_use_hmac = off;
|
||||
PRAGMA cipher_page_size = 1024;
|
||||
PRAGMA kdf_iter = 4000;
|
||||
PRAGMA cipher_compatibility = 1;
|
||||
ATTACH DATABASE "$output" AS db KEY "";
|
||||
SELECT sqlcipher_export("db");
|
||||
DETACH DATABASE db;
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
Copyright (c) 2008, ZETETIC LLC
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the ZETETIC LLC nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY ZETETIC LLC ''AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL ZETETIC LLC BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -1,7 +0,0 @@
|
||||
|
||||
## NOTE
|
||||
|
||||
For convenience, I include the binary version of sqlcipher 2.1.1.
|
||||
|
||||
User can also choose to download and install sqlcipher 2.1.1 from their trusted source, such as:
|
||||
https://launchpad.net/ubuntu/+source/sqlcipher/2.1.1-2
|
||||
Binary file not shown.
@@ -1,130 +0,0 @@
|
||||
#! /bin/sh
|
||||
|
||||
# sqlite3 - temporary wrapper script for .libs/sqlite3
|
||||
# Generated by ltmain.sh (GNU libtool) 2.2.6
|
||||
#
|
||||
# The sqlite3 program cannot be directly executed until all the libtool
|
||||
# libraries that it depends on are installed.
|
||||
#
|
||||
# This wrapper script should never be moved out of the build directory.
|
||||
# If it is, it will not operate correctly.
|
||||
|
||||
# Sed substitution that helps us do robust quoting. It backslashifies
|
||||
# metacharacters that are still active within double-quoted strings.
|
||||
Xsed='/opt/local/bin/gsed -e 1s/^X//'
|
||||
sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
|
||||
|
||||
# Be Bourne compatible
|
||||
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
|
||||
emulate sh
|
||||
NULLCMD=:
|
||||
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
|
||||
# is contrary to our usage. Disable this feature.
|
||||
alias -g '${1+"$@"}'='"$@"'
|
||||
setopt NO_GLOB_SUBST
|
||||
else
|
||||
case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
|
||||
fi
|
||||
BIN_SH=xpg4; export BIN_SH # for Tru64
|
||||
DUALCASE=1; export DUALCASE # for MKS sh
|
||||
|
||||
# The HP-UX ksh and POSIX shell print the target directory to stdout
|
||||
# if CDPATH is set.
|
||||
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
|
||||
|
||||
relink_command=""
|
||||
|
||||
# This environment variable determines our operation mode.
|
||||
if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then
|
||||
# install mode needs the following variables:
|
||||
generated_by_libtool_version='2.2.6'
|
||||
notinst_deplibs=' libsqlite3.la'
|
||||
else
|
||||
# When we are sourced in execute mode, $file and $ECHO are already set.
|
||||
if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then
|
||||
ECHO="/bin/echo"
|
||||
file="$0"
|
||||
# Make sure echo works.
|
||||
if test "X$1" = X--no-reexec; then
|
||||
# Discard the --no-reexec flag, and continue.
|
||||
shift
|
||||
elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
|
||||
# Yippee, $ECHO works!
|
||||
:
|
||||
else
|
||||
# Restart under the correct shell, and then maybe $ECHO will work.
|
||||
exec /bin/sh "$0" --no-reexec ${1+"$@"}
|
||||
fi
|
||||
fi
|
||||
|
||||
# Find the directory that this script lives in.
|
||||
thisdir=`$ECHO "X$file" | $Xsed -e 's%/[^/]*$%%'`
|
||||
test "x$thisdir" = "x$file" && thisdir=.
|
||||
|
||||
# Follow symbolic links until we get to the real thisdir.
|
||||
file=`ls -ld "$file" | /opt/local/bin/gsed -n 's/.*-> //p'`
|
||||
while test -n "$file"; do
|
||||
destdir=`$ECHO "X$file" | $Xsed -e 's%/[^/]*$%%'`
|
||||
|
||||
# If there was a directory component, then change thisdir.
|
||||
if test "x$destdir" != "x$file"; then
|
||||
case "$destdir" in
|
||||
[\\/]* | [A-Za-z]:[\\/]*) thisdir="$destdir" ;;
|
||||
*) thisdir="$thisdir/$destdir" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
file=`$ECHO "X$file" | $Xsed -e 's%^.*/%%'`
|
||||
file=`ls -ld "$thisdir/$file" | /opt/local/bin/gsed -n 's/.*-> //p'`
|
||||
done
|
||||
|
||||
|
||||
# Usually 'no', except on cygwin/mingw when embedded into
|
||||
# the cwrapper.
|
||||
WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=no
|
||||
if test "$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR" = "yes"; then
|
||||
# special case for '.'
|
||||
if test "$thisdir" = "."; then
|
||||
thisdir=`pwd`
|
||||
fi
|
||||
# remove .libs from thisdir
|
||||
case "$thisdir" in
|
||||
*[\\/].libs ) thisdir=`$ECHO "X$thisdir" | $Xsed -e 's%[\\/][^\\/]*$%%'` ;;
|
||||
.libs ) thisdir=. ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Try to get the absolute directory name.
|
||||
absdir=`cd "$thisdir" && pwd`
|
||||
test -n "$absdir" && thisdir="$absdir"
|
||||
|
||||
program='sqlite3'
|
||||
progdir="$thisdir/.libs"
|
||||
|
||||
|
||||
if test -f "$progdir/$program"; then
|
||||
# Add our own library path to DYLD_LIBRARY_PATH
|
||||
DYLD_LIBRARY_PATH="/Users/vuryleo/Projects/sqlcipher/.libs:$DYLD_LIBRARY_PATH"
|
||||
|
||||
# Some systems cannot cope with colon-terminated DYLD_LIBRARY_PATH
|
||||
# The second colon is a workaround for a bug in BeOS R4 sed
|
||||
DYLD_LIBRARY_PATH=`$ECHO "X$DYLD_LIBRARY_PATH" | $Xsed -e 's/::*$//'`
|
||||
|
||||
export DYLD_LIBRARY_PATH
|
||||
|
||||
if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then
|
||||
# Run the actual program with our arguments.
|
||||
|
||||
exec "$progdir/$program" ${1+"$@"}
|
||||
|
||||
$ECHO "$0: cannot exec $program $*" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# The program doesn't exist.
|
||||
$ECHO "$0: error: \`$progdir/$program' does not exist" 1>&2
|
||||
$ECHO "This script is just a wrapper for $program." 1>&2
|
||||
/bin/echo "See the libtool documentation for more information." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user