From d0ec0886c0c98bd525857595a05db58abc9693a5 Mon Sep 17 00:00:00 2001 From: Yuxin Wu Date: Fri, 23 Apr 2021 15:10:33 -0700 Subject: [PATCH] check sqlcipher version (fix #85) --- decrypt-db.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/decrypt-db.py b/decrypt-db.py index d12a888..c93df58 100755 --- a/decrypt-db.py +++ b/decrypt-db.py @@ -137,6 +137,10 @@ def get_key(imei, uin): def do_decrypt(input, output, key): conn = sqlite.connect(input) c = conn.cursor() + version_str = list(conn.execute("PRAGMA cipher_version"))[0][0] + version = tuple([int(x) for x in version_str.split(".")]) + assert version >= (4, 1), "Sqlcipher>=4.1 is required" + c.execute("PRAGMA key = '" + key + "';") # https://github.com/sqlcipher/sqlcipher/commit/e4b66d6cc8a2b7547a32ff2c3ac52f148eba3516 c.execute("PRAGMA cipher_compatibility = 1;")