feat: 添加对python 3.11的反编译模块
This commit is contained in:
@@ -3,6 +3,7 @@ import uncompyle6
|
||||
import io
|
||||
import os
|
||||
import subprocess
|
||||
from contextlib import redirect_stdout, redirect_stderr
|
||||
|
||||
|
||||
def run_pycdc(exe_path: str, pyc_file: str) -> str:
|
||||
@@ -17,15 +18,12 @@ def run_pycdc(exe_path: str, pyc_file: str) -> str:
|
||||
str: Output from pycdc.exe.
|
||||
"""
|
||||
if not os.path.isfile(exe_path):
|
||||
print(f"ERROR: The specified pycdc.exe path is not valid: {exe_path}")
|
||||
print("Please check your pycdc path.")
|
||||
exit(1)
|
||||
return "invalid"
|
||||
|
||||
command = f'"{exe_path}" "{pyc_file}"'
|
||||
result = subprocess.run(command, capture_output=True, text=True, shell=True)
|
||||
|
||||
if result.returncode != 0:
|
||||
raise Exception(f"Error running pycdc.exe: {result.stderr}")
|
||||
result = subprocess.run(
|
||||
command, capture_output=True, text=True, shell=True, encoding="utf-8"
|
||||
)
|
||||
|
||||
return result.stdout
|
||||
|
||||
@@ -46,10 +44,6 @@ def disassemble_pyc(file_path: str, pycdc_addr=None) -> str:
|
||||
return output.getvalue()
|
||||
except Exception as e:
|
||||
if pycdc_addr is None:
|
||||
print(
|
||||
"ERROR: For Python 3.11 and above, you need to install pycdc and compile it yourself to obtain pycdc.exe."
|
||||
)
|
||||
print("repo: https://github.com/zrax/pycdc.git")
|
||||
exit(1)
|
||||
return "none"
|
||||
else:
|
||||
return run_pycdc(pycdc_addr, file_path)
|
||||
|
||||
Reference in New Issue
Block a user