import os, sys sys.path.insert(0, '/data/data/com.termux/files/home/local-testkit') import hermes_wechat_daemon as d d.load_config() d.setup_logging(d.config.get('logging', {})) # Check if hermes_work already exists work_dir = '/data/data/com.termux/files/home/hermes_work' print('work_dir exists=', os.path.exists(work_dir)) if os.path.exists(work_dir): files = os.listdir(work_dir) print('work_dir files=', files) for f in files: p = os.path.join(work_dir, f) print(' ', f, os.path.getsize(p)) # Simulate poll_cycle exactly src = d.config.get('db_src_path', '') if not src: src = d.find_enmicromsg_db() termux_home = '/data/data/com.termux/files/home' work_dir = os.path.join(termux_home, 'hermes_work') print('makedirs work_dir...') 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 = os.path.join(termux_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('calling 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))