feat: 添加对pyc文件的反汇编功能模块
This commit is contained in:
22
detection/pyc_detection.py
Normal file
22
detection/pyc_detection.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from typing import List, Tuple
|
||||
import uncompyle6
|
||||
import io
|
||||
|
||||
|
||||
def disassemble_pyc(file_path: str) -> str:
|
||||
"""
|
||||
Disassembles a .pyc file using uncompyle6.
|
||||
|
||||
Args:
|
||||
file_path (str): The path to the .pyc file.
|
||||
|
||||
Returns:
|
||||
str: The disassembled code as a string.
|
||||
"""
|
||||
output = io.StringIO()
|
||||
try:
|
||||
uncompyle6.main.decompile_file(file_path, output)
|
||||
return output.getvalue()
|
||||
except Exception as e:
|
||||
print(f"Error occurred while disassembling: {e}")
|
||||
return ""
|
||||
Reference in New Issue
Block a user