yuag / Code-audit

代码审计
74 stars 10 forks source link

自动代码审计和GPT代码审计 #2

Open Marco-zcl opened 1 month ago

Marco-zcl commented 1 month ago

自动代码审计的YAML的规则,需要在哪里找到呢 还有使用GPT闪退返回代码为 Traceback (most recent call last): File "c:\Users\2tina\Desktop\code代码\main.py", line 235, in audit_single_file response = openai.ChatCompletion.create( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\2tina\AppData\Roaming\Python\Python311\site-packages\openai\lib_old_api.py", line 39, in call raise APIRemovedInV1(symbol=self._symbol) openai.lib._old_api.APIRemovedInV1:

You tried to access openai.ChatCompletion, but this is no longer supported in openai>=1.0.0 - see the README at https://github.com/openai/openai-python for the API.

You can run openai migrate to automatically upgrade your codebase to use the 1.0.0 interface.

Alternatively, you can pin your installation to the old version, e.g. pip install openai==0.28

A detailed migration guide is available here: https://github.com/openai/openai-python/discussions/742

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "c:\Users\2tina\Desktop\code代码\main.py", line 227, in code_audit self.audit_directory(code_path, api_key) File "c:\Users\2tina\Desktop\code代码\main.py", line 258, in audit_directory self.audit_single_file(file_path, api_key) File "c:\Users\2tina\Desktop\code代码\main.py", line 249, in audit_single_file except openai.error.RateLimitError: ^^^^^^^^^^^^ AttributeError: module 'openai' has no attribute 'error'

yuag commented 1 month ago

https://github.com/yuag/Code-audit/blob/main/sql.yaml yaml文件按照这个格式写就可以。