Compare commits

...

2 Commits

Author SHA1 Message Date
dqy
e418bbf380 test: 添加反汇编之后的正则匹配测试 2024-05-29 20:32:24 +08:00
dqy
d30ea0ca61 feat: 添加反汇编模块依赖 2024-05-29 20:31:42 +08:00
2 changed files with 19 additions and 1 deletions

View File

@ -2,4 +2,5 @@ reportlab
requests
packaging
openai
bs4
bs4
uncompyle6

View File

@ -90,6 +90,23 @@ class TestBackdoorDetection(unittest.TestCase):
with self.assertRaises(ValueError):
detectGPT(content)
def test_find_dangerous_functions_pyc(self):
file_content = """import os
os.system('rm -rf /')
"""
file_extension = ".pyc"
expected_result = {
"high": [(2, "os.system('rm -rf /')")],
"medium": [],
"low": [],
"none": [],
}
result = find_dangerous_functions(file_content, file_extension)
self.assertEqual(result, expected_result)
if __name__ == "__main__":
unittest.main()