AI驱动的Python代码安全审计工具
Project description
aiguard-py
一行命令安装,一行命令审计 Python 代码安全漏洞
AI 驱动的代码审计工具,识别 SQL注入、命令注入、硬编码密码 等常见漏洞,每条带 CWE 编号 和 可执行的修复代码示例。
🚀 快速开始
# 1. 安装
pip install aiguard-py
# 2. 审计单个文件
aiguard test.py
# 3. 批量扫描整个项目
aiguard ./src
# 4. 生成 HTML 报告
aiguard test.py --output report.html
输出示例:
[高危] SQL注入 - 第20行
CWE: CWE-89
问题: 使用 f-string 拼接 SQL 查询,攻击者可注入恶意代码
修复建议: 使用参数化查询
---
错误写法: cursor.execute(f"SELECT * FROM users WHERE name = '{name}'")
正确写法: cursor.execute("SELECT * FROM users WHERE name = ?", (name,))
[高危] 命令注入 - 第7行
CWE: CWE-78
问题: os.system() 直接拼接用户输入
修复建议: 使用 subprocess.run() 传递参数列表
---
错误写法: os.system("rm -rf " + filename)
正确写法: subprocess.run(["rm", "-rf", filename])
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aiguard_py-0.5.0.tar.gz
(7.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aiguard_py-0.5.0.tar.gz.
File metadata
- Download URL: aiguard_py-0.5.0.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6cd62e6338c26f6841fdd96b7f2c47c6b6cfece8a0c38dbe8b0587c0e140f3e
|
|
| MD5 |
12478b5d3311a5344be6d6b9be47a237
|
|
| BLAKE2b-256 |
2ede186aae9326264717045a6c35a147c7477856fbf98aaf739ce4a4f35bf4ed
|
File details
Details for the file aiguard_py-0.5.0-py3-none-any.whl.
File metadata
- Download URL: aiguard_py-0.5.0-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d1b6eff59f330d9ac90a0766c1295593293b087f5317e91554e79cb1dfd0702
|
|
| MD5 |
58850cdf9b41aeef2f889c687f0b67d8
|
|
| BLAKE2b-256 |
1c2dff7ed0f0fa45b6e1ce7d70e39d972a9bad4ef844bd11aead09e7ba5898b5
|