aiguard-py 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aiguard_py-0.1.0/LICENSE +21 -0
- aiguard_py-0.1.0/PKG-INFO +28 -0
- aiguard_py-0.1.0/README.md +8 -0
- aiguard_py-0.1.0/pyproject.toml +29 -0
- aiguard_py-0.1.0/setup.cfg +4 -0
- aiguard_py-0.1.0/setup.py +27 -0
- aiguard_py-0.1.0/src/aiguard/__init__.py +0 -0
- aiguard_py-0.1.0/src/aiguard/cli.py +72 -0
- aiguard_py-0.1.0/src/aiguard_py.egg-info/PKG-INFO +28 -0
- aiguard_py-0.1.0/src/aiguard_py.egg-info/SOURCES.txt +12 -0
- aiguard_py-0.1.0/src/aiguard_py.egg-info/dependency_links.txt +1 -0
- aiguard_py-0.1.0/src/aiguard_py.egg-info/entry_points.txt +2 -0
- aiguard_py-0.1.0/src/aiguard_py.egg-info/requires.txt +1 -0
- aiguard_py-0.1.0/src/aiguard_py.egg-info/top_level.txt +1 -0
aiguard_py-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 烽桐数字
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aiguard-py
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: AI驱动的Python代码安全审计工具
|
|
5
|
+
Home-page: https://github.com/你的用户名/aiguard
|
|
6
|
+
Author: 你的名字
|
|
7
|
+
Author-email: 烽桐数字 <15393612830@139.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Requires-Python: >=3.8
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: openai>=1.0.0
|
|
16
|
+
Dynamic: author
|
|
17
|
+
Dynamic: home-page
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
Dynamic: requires-python
|
|
20
|
+
|
|
21
|
+
# aiguard
|
|
22
|
+
|
|
23
|
+
AI驱动的Python代码安全审计工具。一键扫描Python代码中的安全漏洞。
|
|
24
|
+
|
|
25
|
+
## 安装
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install aiguard
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77.0.3", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "aiguard-py"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name = "烽桐数字", email = "15393612830@139.com" },
|
|
10
|
+
]
|
|
11
|
+
description = "AI驱动的Python代码安全审计工具"
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.8"
|
|
14
|
+
license = { text = "MIT" }
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
dependencies = [
|
|
22
|
+
"openai>=1.0.0",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.scripts]
|
|
26
|
+
aiguard = "aiguard.cli:main"
|
|
27
|
+
|
|
28
|
+
[tool.setuptools.packages.find]
|
|
29
|
+
where = ["src"]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="aiguard",
|
|
5
|
+
version="0.1.0",
|
|
6
|
+
packages=find_packages(),
|
|
7
|
+
install_requires=[
|
|
8
|
+
"openai>=1.0.0",
|
|
9
|
+
],
|
|
10
|
+
entry_points={
|
|
11
|
+
"console_scripts": [
|
|
12
|
+
"aiguard=aiguard.cli:main",
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
author="你的名字",
|
|
16
|
+
author_email="你的邮箱",
|
|
17
|
+
description="AI驱动的Python代码安全审计工具",
|
|
18
|
+
long_description="用AI检测Python代码中的安全漏洞,给出修复建议",
|
|
19
|
+
long_description_content_type="text/markdown",
|
|
20
|
+
url="https://github.com/你的用户名/aiguard",
|
|
21
|
+
classifiers=[
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"License :: OSI Approved :: MIT License",
|
|
24
|
+
"Operating System :: OS Independent",
|
|
25
|
+
],
|
|
26
|
+
python_requires=">=3.8",
|
|
27
|
+
)
|
|
File without changes
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
AI代码安全审计工具 - aiguard
|
|
4
|
+
用法: aiguard <文件路径>
|
|
5
|
+
"""
|
|
6
|
+
import sys
|
|
7
|
+
import argparse
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
from openai import OpenAI
|
|
10
|
+
|
|
11
|
+
# 配置AI客户端
|
|
12
|
+
client = OpenAI(
|
|
13
|
+
api_key="sk-67310863a7e14ce1a9a3d1effc3b99fc",
|
|
14
|
+
base_url="https://api.deepseek.com/v1" # DeepSeek 官方的地址
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def scan_file(filepath):
|
|
19
|
+
"""扫描单个Python文件"""
|
|
20
|
+
try:
|
|
21
|
+
with open(filepath, 'r', encoding='utf-8') as f:
|
|
22
|
+
code = f.read()
|
|
23
|
+
except Exception as e:
|
|
24
|
+
print(f"❌ 读取文件失败: {e}")
|
|
25
|
+
return
|
|
26
|
+
|
|
27
|
+
print(f"\n🔍 正在审计: {filepath}")
|
|
28
|
+
print("=" * 60)
|
|
29
|
+
|
|
30
|
+
try:
|
|
31
|
+
response = client.chat.completions.create(
|
|
32
|
+
model="deepseek-chat",
|
|
33
|
+
messages=[
|
|
34
|
+
{"role": "system",
|
|
35
|
+
"content": "你是Python代码安全审计专家。只输出漏洞列表,格式:\n[高危] 问题描述 - 行号\n[中危] 问题描述 - 行号\n[低危] 问题描述 - 行号\n如果没有问题,输出:✅ 未发现明显安全漏洞"},
|
|
36
|
+
{"role": "user", "content": f"审计这段Python代码:\n```python\n{code}\n```"}
|
|
37
|
+
],
|
|
38
|
+
temperature=0.3,
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
result = response.choices[0].message.content
|
|
42
|
+
print(result)
|
|
43
|
+
print("\n" + "=" * 60)
|
|
44
|
+
|
|
45
|
+
except Exception as e:
|
|
46
|
+
print(f"❌ AI分析失败: {e}")
|
|
47
|
+
print("提示: 请检查API Key是否正确,或网络是否畅通")
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def main():
|
|
51
|
+
parser = argparse.ArgumentParser(
|
|
52
|
+
description="AI代码安全审计工具",
|
|
53
|
+
epilog="示例: aiguard app.py"
|
|
54
|
+
)
|
|
55
|
+
parser.add_argument("target", help="要扫描的Python文件路径")
|
|
56
|
+
parser.add_argument("--version", action="version", version="aiguard 0.1.0")
|
|
57
|
+
args = parser.parse_args()
|
|
58
|
+
|
|
59
|
+
target_path = Path(args.target)
|
|
60
|
+
if not target_path.exists():
|
|
61
|
+
print(f"❌ 文件不存在: {args.target}")
|
|
62
|
+
sys.exit(1)
|
|
63
|
+
|
|
64
|
+
if not target_path.suffix == '.py':
|
|
65
|
+
print(f"❌ 只支持Python文件,当前文件后缀: {target_path.suffix}")
|
|
66
|
+
sys.exit(1)
|
|
67
|
+
|
|
68
|
+
scan_file(str(target_path))
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
if __name__ == "__main__":
|
|
72
|
+
main()
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aiguard-py
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: AI驱动的Python代码安全审计工具
|
|
5
|
+
Home-page: https://github.com/你的用户名/aiguard
|
|
6
|
+
Author: 你的名字
|
|
7
|
+
Author-email: 烽桐数字 <15393612830@139.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Requires-Python: >=3.8
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: openai>=1.0.0
|
|
16
|
+
Dynamic: author
|
|
17
|
+
Dynamic: home-page
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
Dynamic: requires-python
|
|
20
|
+
|
|
21
|
+
# aiguard
|
|
22
|
+
|
|
23
|
+
AI驱动的Python代码安全审计工具。一键扫描Python代码中的安全漏洞。
|
|
24
|
+
|
|
25
|
+
## 安装
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install aiguard
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
setup.py
|
|
5
|
+
src/aiguard/__init__.py
|
|
6
|
+
src/aiguard/cli.py
|
|
7
|
+
src/aiguard_py.egg-info/PKG-INFO
|
|
8
|
+
src/aiguard_py.egg-info/SOURCES.txt
|
|
9
|
+
src/aiguard_py.egg-info/dependency_links.txt
|
|
10
|
+
src/aiguard_py.egg-info/entry_points.txt
|
|
11
|
+
src/aiguard_py.egg-info/requires.txt
|
|
12
|
+
src/aiguard_py.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
openai>=1.0.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
aiguard
|