import os # 获取当前Python脚本的绝对路径 def get_path(script_name): script_directory = os.path.dirname(os.path.abspath(__file__)) parent_directory = os.path.dirname(script_directory) # 使用os.path.join构建hook_conversions.js的完整路径 script_path = os.path.join(parent_directory,script_name) print(script_path) return script_path def read_javascript(script_path): with open(script_path, "r") as file: script_code = file.read() return script_code def write_log(messages): global FIRST_WRITE print(f"FIRST_WRITE: {FIRST_WRITE}") with open("frida_log.log", "a") as log_file: if FIRST_WRITE: # 如果是首次写入 log_file.write("\n\n\n") # 空出三行 FIRST_WRITE = False # 更新状态,表明已经写过了 log_file.write(str(messages) + "\n")