dev commits.

This commit is contained in:
MasOnShi
2022-04-03 20:22:25 +08:00
parent 18e2562146
commit e21922b1f1
7 changed files with 8 additions and 6 deletions

View File

@@ -44,13 +44,15 @@ def extract_file(from_path, to_path):
subprocess.check_call(["innoextract", from_path, "-d", to_path])
def patch_file(_key, _iv):
patch_file_path = os.path.join(BASE_DIR, "../typora.py")
fd = open(patch_file_path, "a+")
content = fd.read()
def patch_file(_key, _iv, to_dir):
patch_file_path = os.path.join(BASE_DIR, "../exports/typora.py")
content = open(patch_file_path, "r").read()
content = content.replace("{AES_KEY}", f"b''.fromhex('{_key}')")
content = content.replace("{AES_IV}", f"b''.fromhex('{_iv}')")
fd.write(content)
save_dir = os.path.join(to_dir, "build")
os.makedirs()
open(os.path.join(to_dir, "typora.py"), "w").write(content)
def win_x64_run():
@@ -68,7 +70,7 @@ def win_x64_run():
key, iv = analysis.get_aes_key_and_iv(main_node_path)
log.success("analysis done")
patch_file(key.hex(), iv.hex())
patch_file(key.hex(), iv.hex(), basedir)
log.success("patch done")