feat: 添加对pyc文件的反汇编功能模块

This commit is contained in:
dqy
2024-05-29 20:08:40 +08:00
parent 27ec14be54
commit 40f5c07fa1
3 changed files with 53 additions and 10 deletions

View File

@@ -25,6 +25,16 @@ def find_dangerous_functions(
".cpp": {
r"\bsystem\(": "high",
},
".pyc": {
r"\bexec\b": "high",
r"\beval\b": "high",
r"\bos\.system\b": "high",
r"\bos\.exec\b": "high",
r"\bos\.fork\b": "high",
r"\bos\.kill\b": "high",
r"\bos\.popen\b": "medium",
r"\bos\.spawn\b": "medium",
},
}
risk_patterns = patterns.get(file_extension, {})
classified_results = {"high": [], "medium": [], "low": [], "none": []}
@@ -36,4 +46,3 @@ def find_dangerous_functions(
if re.search(pattern, clean_line):
classified_results[risk_level].append((line_number, clean_line))
return classified_results