debug_poll.py
1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import sys, os
sys.path.insert(0, '/data/data/com.termux/files/home/local-testkit')
import hermes_wechat_daemon as d
print('load_config...')
d.load_config()
print('setup_logging...')
d.setup_logging(d.config.get('logging', {}))
print('db_src=', d.config.get('db_src_path'))
print('copy_dir=', d.config.get('db_copy_dir'))
# Simulate poll_cycle manually
src = d.config.get('db_src_path')
work_dir = '/data/data/com.termux/files/home/hermes_work'
print('makedirs...')
os.makedirs(work_dir, exist_ok=True)
print('copy_db...')
copied = d.copy_db(src, work_dir)
print('copied=', copied)
enc = os.path.join(work_dir, 'EnMicroMsg.db')
plain = '/data/data/com.termux/files/home/EnMicroMsg.db.decrypted.db'
print('enc exists=', os.path.exists(enc))
print('enc size=', os.path.getsize(enc) if os.path.exists(enc) else 0)
if os.path.exists(plain):
os.remove(plain)
print('removed old plain')
print('decrypt_db...')
ok = d.decrypt_db(enc, plain, d.config.get('sqlcipher_key'), 1024, 1)
print('decrypt ok=', ok)
print('plain exists=', os.path.exists(plain))
if os.path.exists(plain):
print('plain size=', os.path.getsize(plain))