adds support for linux-x64

This commit is contained in:
MasOnShi
2022-04-04 20:26:45 +08:00
parent e6b6d7a9e1
commit 19e73b6c79

View File

@@ -27,7 +27,10 @@ def download_file(from_link, to_path):
def extract_file(from_path, to_path):
subprocess.check_call(["innoextract", from_path, "-d", to_path])
if from_path.endswith(".exe"):
subprocess.check_call(["innoextract", from_path, "-d", to_path])
elif from_path.endswith(".tar.gz"):
subprocess.check_call(["tar", "-zxvf", from_path, "-C", to_path])
def patch_file(_key, _iv, to_dir):
@@ -44,7 +47,7 @@ def patch_file(_key, _iv, to_dir):
open(patch_file_path, "w").write(content)
def scheduler(func, basedir, link):
def scheduler(func, basedir, link, root_path):
download_path = os.path.join(basedir, os.path.basename(link))
log.info(f"downloading from {link}")
@@ -53,7 +56,8 @@ def scheduler(func, basedir, link):
extract_file(download_path, basedir)
log.info("preparation stage completed")
main_node_path = os.path.join(basedir, "app/resources/app.asar.unpacked/main.node")
main_node_path = os.path.join(basedir, os.path.join(root_path, "resources/app.asar.unpacked/main.node"))
log.info("auto analysis start")
key, iv = func.get_aes_key_and_iv(main_node_path)
log.success("analysis done")
@@ -66,21 +70,21 @@ def win_x64_run():
from win.x64 import analysis
dirs = os.path.join(BASE_DIR, "win/x64")
url = DOWNLOAD_LINK["win"]["x64"]
scheduler(func=analysis, basedir=dirs, link=url)
scheduler(func=analysis, basedir=dirs, link=url, root_path="app")
def win_x86_run():
from win.x86 import analysis
dirs = os.path.join(BASE_DIR, "win/x86")
url = DOWNLOAD_LINK["win"]["x86"]
scheduler(func=analysis, basedir=dirs, link=url)
scheduler(func=analysis, basedir=dirs, link=url, root_path="app")
def linux_x64_run():
from linux.x64 import analysis
dirs = os.path.join(BASE_DIR, "linux/x64")
url = DOWNLOAD_LINK["linux"]["x64"]
scheduler(func=analysis, basedir=dirs, link=url)
scheduler(func=analysis, basedir=dirs, link=url, root_path="bin/Typora-linux-x64")
if __name__ == '__main__':