mirror of
https://github.com/Mas0nShi/typoraCracker.git
synced 2023-07-10 13:41:20 +08:00
Merge pull request #58 from Mas0nShi/auto-analysis-dev
#57: add support for linux-x64
This commit is contained in:
@@ -1,22 +1,23 @@
|
||||
from utils import get_version, download_file, extract_file, log, DOWNLOAD_LINK
|
||||
from utils import get_version, download_file, extract_file, log
|
||||
from config import DOWNLOAD_LINK
|
||||
import os
|
||||
|
||||
BASE_DIR = os.path.dirname(__file__)
|
||||
|
||||
|
||||
def win_x64_version():
|
||||
url = DOWNLOAD_LINK["win"]["x64"]
|
||||
dir = os.path.join(BASE_DIR, "win/x64")
|
||||
def run_version(download_os, download_arch):
|
||||
from_url = DOWNLOAD_LINK[download_os][download_arch]
|
||||
to_dir = os.path.join(BASE_DIR, f"{download_os}/{download_arch}")
|
||||
|
||||
download_path = os.path.join(dir, os.path.basename(url))
|
||||
download_file(url, download_path)
|
||||
extract_file(download_path, dir)
|
||||
version = get_version(dir)
|
||||
|
||||
open(os.path.join(dir, "LATEST_VERSION"), "w").write(version)
|
||||
log.success(version)
|
||||
download_path = os.path.join(to_dir, os.path.basename(from_url))
|
||||
download_file(from_url, download_path)
|
||||
extract_file(download_path, to_dir)
|
||||
version = get_version(to_dir)
|
||||
open(os.path.join(to_dir, "LATEST_VERSION"), "w").write(version)
|
||||
log.success(f"{download_os}-{download_arch} the latest version is {version}")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
win_x64_version()
|
||||
|
||||
run_version("win", "x64")
|
||||
# run_version("win", "x86")
|
||||
# run_version("linux", "x64")
|
||||
|
||||
20
auto-analysis/config.py
Normal file
20
auto-analysis/config.py
Normal file
@@ -0,0 +1,20 @@
|
||||
# -*- coding:utf-8 -*-
|
||||
"""
|
||||
@Author: Mas0n
|
||||
@File: config.py
|
||||
@Time: 2022/4/4 19:50
|
||||
@Desc: It's all about getting better.
|
||||
"""
|
||||
|
||||
|
||||
DOWNLOAD_LINK = {
|
||||
"win": {
|
||||
"x86": "https://typora.io/windows/typora-setup-ia32.exe",
|
||||
"x64": "https://typora.io/windows/typora-setup-x64.exe",
|
||||
"arm64": "https://typora.io/windows/typora-setup-arm64.exe",
|
||||
},
|
||||
"linux": {
|
||||
"x64": "https://download.typora.io/linux/Typora-linux-x64.tar.gz",
|
||||
"arm64": "https://download.typora.io/linux/Typora-linux-arm64.tar.gz",
|
||||
},
|
||||
}
|
||||
32
auto-analysis/linux/x64/analysis.py
Normal file
32
auto-analysis/linux/x64/analysis.py
Normal file
@@ -0,0 +1,32 @@
|
||||
# -*- coding:utf-8 -*-
|
||||
"""
|
||||
@Author: Mas0n
|
||||
@Name: typora_linux_x64_analysis
|
||||
@Time: 2022/4/4 19:48
|
||||
@Desc: It's all about getting better.
|
||||
"""
|
||||
import json
|
||||
import r2pipe
|
||||
|
||||
|
||||
def get_aes_key_and_iv(file_path):
|
||||
r = r2pipe.open(file_path)
|
||||
|
||||
r.cmd("aaa")
|
||||
regex = r.cmdj("axtj @@ str.base64")
|
||||
assert len(regex) == 1
|
||||
|
||||
func = regex[0]["fcn_name"]
|
||||
r.cmd(f"s {func}")
|
||||
asm = r.cmdj("pdfj")['ops']
|
||||
assert len(asm) != 0
|
||||
|
||||
if 'str.dip3' in json.dumps(asm):
|
||||
r.cmd('s str.dip3 - 32')
|
||||
data = r.cmdj('xj 48')
|
||||
key = bytearray(data[0:32])
|
||||
iv = bytearray(data[32:48])
|
||||
else:
|
||||
raise "need rewrite scripts for linux x64"
|
||||
|
||||
return key, iv
|
||||
@@ -10,4 +10,5 @@ import utils
|
||||
if __name__ == '__main__':
|
||||
utils.win_x86_run()
|
||||
utils.win_x64_run()
|
||||
utils.linux_x64_run()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user