neosec 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.
- neosec-0.1.0/LICENSE +21 -0
- neosec-0.1.0/PKG-INFO +388 -0
- neosec-0.1.0/README.md +367 -0
- neosec-0.1.0/pyproject.toml +36 -0
- neosec-0.1.0/src/neobee/__init__.py +3 -0
- neosec-0.1.0/src/neobee/cli/__init__.py +1 -0
- neosec-0.1.0/src/neobee/cli/main.py +386 -0
- neosec-0.1.0/src/neobee/core/__init__.py +1 -0
- neosec-0.1.0/src/neobee/core/config.py +154 -0
- neosec-0.1.0/src/neobee/core/engine.py +580 -0
- neosec-0.1.0/src/neobee/core/template.py +280 -0
- neosec-0.1.0/src/neobee/templates/__init__.py +1 -0
- neosec-0.1.0/src/neobee/utils/__init__.py +1 -0
- neosec-0.1.0/src/neobee/utils/ui.py +314 -0
- neosec-0.1.0/src/neobee/utils/variables.py +100 -0
neosec-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Neosec Contributors
|
|
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.
|
neosec-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: neosec
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Network security workflow automation CLI tool
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Author: Neobee714
|
|
7
|
+
Author-email: 1321247001@qq.com
|
|
8
|
+
Requires-Python: >=3.10,<4.0
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
|
+
Requires-Dist: aiofiles (>=23.2.1,<24.0.0)
|
|
16
|
+
Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
|
|
17
|
+
Requires-Dist: rich (>=13.7.0,<14.0.0)
|
|
18
|
+
Requires-Dist: typer[all] (>=0.12.0)
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
|
|
21
|
+
# Neosec
|
|
22
|
+
|
|
23
|
+
[](https://www.python.org/downloads/)
|
|
24
|
+
[](LICENSE)
|
|
25
|
+
|
|
26
|
+
Neosec 是一款为渗透测试人员提供便捷的工作流自动化 CLI 工具。
|
|
27
|
+
|
|
28
|
+
## 特性
|
|
29
|
+
|
|
30
|
+
- 🚀 **工作流自动化**: 通过 JSON 模板定义和执行复杂的安全测试工作流
|
|
31
|
+
- ⚡ **并行执行**: 支持多个独立任务同时执行,提高测试效率
|
|
32
|
+
- 🔀 **条件执行**: 根据前置步骤的结果动态决定执行路径
|
|
33
|
+
- 🔗 **数据传递**: 步骤间无缝传递和引用执行结果
|
|
34
|
+
- 📊 **实时进度**: 美观的终端 UI 实时显示执行进度
|
|
35
|
+
- 🔄 **错误重试**: 自动重试失败的步骤,提高稳定性
|
|
36
|
+
- 📝 **执行历史**: 自动记录所有执行历史,方便回溯
|
|
37
|
+
- 🎨 **自定义工具**: 支持集成任何命令行工具或自定义脚本
|
|
38
|
+
|
|
39
|
+
## 安装
|
|
40
|
+
|
|
41
|
+
### 使用 Poetry
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# 克隆仓库
|
|
45
|
+
git clone https://github.com/Neobee714/neosec.git
|
|
46
|
+
cd neosec
|
|
47
|
+
|
|
48
|
+
# 安装依赖
|
|
49
|
+
poetry install
|
|
50
|
+
|
|
51
|
+
# 激活虚拟环境
|
|
52
|
+
poetry shell
|
|
53
|
+
|
|
54
|
+
# 初始化配置
|
|
55
|
+
neosec init
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 使用 pip
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# 克隆仓库
|
|
62
|
+
git clone https://github.com/Neobee714/neosec.git
|
|
63
|
+
cd neosec
|
|
64
|
+
|
|
65
|
+
# 安装
|
|
66
|
+
pip install -e .
|
|
67
|
+
|
|
68
|
+
# 初始化配置
|
|
69
|
+
neosec init
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 使用pipx(推荐)
|
|
73
|
+
```bash
|
|
74
|
+
# 克隆仓库
|
|
75
|
+
git clone https://github.com/Neobee714/neosec.git
|
|
76
|
+
cd neosec
|
|
77
|
+
|
|
78
|
+
# 安装
|
|
79
|
+
pipx install .
|
|
80
|
+
|
|
81
|
+
# 初始化配置
|
|
82
|
+
neosec init
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## 快速开始
|
|
86
|
+
|
|
87
|
+
### 1. 初始化
|
|
88
|
+
|
|
89
|
+
首次使用需要初始化配置和目录结构:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
neosec init
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
这将创建:
|
|
96
|
+
- `~/.neosec/config.yaml` - 配置文件
|
|
97
|
+
- `~/.neosec/templates/` - 用户模板目录
|
|
98
|
+
- `~/.neosec/log/` - 日志目录
|
|
99
|
+
- `~/.neosec/history/` - 执行历史目录
|
|
100
|
+
|
|
101
|
+
### 2. 查看可用模板
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
neosec workflow --list-templates
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 3. 执行工作流
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# 使用内置模板
|
|
111
|
+
neosec workflow --template sequential_workflow --variables target:example.com
|
|
112
|
+
|
|
113
|
+
# 使用自定义模板
|
|
114
|
+
neosec workflow --template ./my_workflow.json --variables target:192.168.1.1
|
|
115
|
+
|
|
116
|
+
# 指定多个变量
|
|
117
|
+
neosec workflow --template parallel_workflow \
|
|
118
|
+
--variables target:example.com \
|
|
119
|
+
--variables wordlist:/usr/share/wordlists/common.txt
|
|
120
|
+
|
|
121
|
+
# 生成 Markdown 报告
|
|
122
|
+
neosec workflow --template full_scan \
|
|
123
|
+
--variables target:example.com \
|
|
124
|
+
--output ./results/scan.json \
|
|
125
|
+
--report
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### 4. 查看执行历史
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# 查看最近 10 条历史
|
|
132
|
+
neosec history
|
|
133
|
+
|
|
134
|
+
# 查看最近 20 条
|
|
135
|
+
neosec history --limit 20
|
|
136
|
+
|
|
137
|
+
# 筛选特定工作流
|
|
138
|
+
neosec history --workflow parallel_workflow
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## 工作流模板
|
|
142
|
+
|
|
143
|
+
### 模板结构
|
|
144
|
+
|
|
145
|
+
```json
|
|
146
|
+
{
|
|
147
|
+
"name": "my_workflow",
|
|
148
|
+
"description": "我的自定义工作流",
|
|
149
|
+
"version": "1.0.0",
|
|
150
|
+
"variables": {
|
|
151
|
+
"target": "example.com",
|
|
152
|
+
"wordlist": "/usr/share/wordlists/common.txt"
|
|
153
|
+
},
|
|
154
|
+
"steps": [
|
|
155
|
+
{
|
|
156
|
+
"id": "port_scan",
|
|
157
|
+
"order": 1,
|
|
158
|
+
"name": "端口扫描",
|
|
159
|
+
"tool": "nmap",
|
|
160
|
+
"args": {
|
|
161
|
+
"-sV": true,
|
|
162
|
+
"target": "{{target}}"
|
|
163
|
+
},
|
|
164
|
+
"save_result_as": "port_scan_result",
|
|
165
|
+
"timeout": 300,
|
|
166
|
+
"retry": 1,
|
|
167
|
+
"continue_on_error": false
|
|
168
|
+
}
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### 核心功能
|
|
174
|
+
|
|
175
|
+
#### 1. 并行执行
|
|
176
|
+
|
|
177
|
+
使用 `parallel_group` 将多个步骤分组并行执行:
|
|
178
|
+
|
|
179
|
+
```json
|
|
180
|
+
{
|
|
181
|
+
"id": "subdomain_enum",
|
|
182
|
+
"order": 1,
|
|
183
|
+
"parallel_group": "recon",
|
|
184
|
+
"tool": "subfinder",
|
|
185
|
+
"args": {"domain": "{{target}}"}
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
#### 2. 条件执行
|
|
190
|
+
|
|
191
|
+
使用 `when` 根据前置步骤结果决定是否执行:
|
|
192
|
+
|
|
193
|
+
```json
|
|
194
|
+
{
|
|
195
|
+
"id": "web_scan",
|
|
196
|
+
"depends_on": ["port_scan"],
|
|
197
|
+
"when": {
|
|
198
|
+
"type": "contains_any",
|
|
199
|
+
"source": "port_scan_result.open_ports",
|
|
200
|
+
"values": [80, 443, 8080]
|
|
201
|
+
},
|
|
202
|
+
"tool": "ffuf"
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
支持的条件类型:
|
|
207
|
+
- `contains`: 包含指定值
|
|
208
|
+
- `contains_any`: 包含任意一个值
|
|
209
|
+
- `not_contains_any`: 不包含任何值
|
|
210
|
+
- `equals`: 精确匹配
|
|
211
|
+
- `greater_than`: 大于
|
|
212
|
+
- `less_than`: 小于
|
|
213
|
+
|
|
214
|
+
#### 3. 数据传递
|
|
215
|
+
|
|
216
|
+
使用 `save_result_as` 保存结果,使用 `{{variable}}` 引用:
|
|
217
|
+
|
|
218
|
+
```json
|
|
219
|
+
{
|
|
220
|
+
"id": "port_scan",
|
|
221
|
+
"save_result_as": "ports",
|
|
222
|
+
"tool": "nmap"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"id": "service_scan",
|
|
226
|
+
"depends_on": ["port_scan"],
|
|
227
|
+
"args": {
|
|
228
|
+
"ports": "{{ports.open_ports}}"
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
#### 4. 循环执行
|
|
234
|
+
|
|
235
|
+
使用 `for_each` 对数组元素循环执行:
|
|
236
|
+
|
|
237
|
+
```json
|
|
238
|
+
{
|
|
239
|
+
"id": "scan_ports",
|
|
240
|
+
"for_each": "{{ports.open_ports}}",
|
|
241
|
+
"args": {
|
|
242
|
+
"port": "{{item.port}}",
|
|
243
|
+
"service": "{{item.service}}"
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## 配置文件
|
|
249
|
+
|
|
250
|
+
配置文件位于 `~/.neosec/config.yaml`:
|
|
251
|
+
|
|
252
|
+
```yaml
|
|
253
|
+
# 工具路径配置
|
|
254
|
+
tools:
|
|
255
|
+
nmap: /usr/bin/nmap
|
|
256
|
+
ffuf: /usr/local/bin/ffuf
|
|
257
|
+
subfinder: /usr/bin/subfinder
|
|
258
|
+
nuclei: /usr/bin/nuclei
|
|
259
|
+
|
|
260
|
+
# 默认参数
|
|
261
|
+
defaults:
|
|
262
|
+
wordlist: /usr/share/wordlists/dirb/common.txt
|
|
263
|
+
timeout: 300
|
|
264
|
+
retry: 1
|
|
265
|
+
|
|
266
|
+
# 输出配置
|
|
267
|
+
output:
|
|
268
|
+
default_path: ./
|
|
269
|
+
default_filename: workflow_result.json
|
|
270
|
+
log_path: ~/.neosec/log/
|
|
271
|
+
|
|
272
|
+
# 其他配置
|
|
273
|
+
verbose: false
|
|
274
|
+
quiet: false
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
## 命令行选项
|
|
278
|
+
|
|
279
|
+
### 全局选项
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
neosec --version # 显示版本信息
|
|
283
|
+
neosec --help # 显示帮助信息
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### workflow 命令
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
neosec workflow [OPTIONS]
|
|
290
|
+
|
|
291
|
+
选项:
|
|
292
|
+
--template, -t TEXT 模板名称或文件路径
|
|
293
|
+
--list-templates 列出所有可用模板
|
|
294
|
+
--validate TEXT 验证模板文件
|
|
295
|
+
--variables, -v TEXT 变量值 (格式: key:value)
|
|
296
|
+
--output, -o TEXT 输出文件路径
|
|
297
|
+
--report 生成 Markdown 报告
|
|
298
|
+
--dry-run 干运行模式,不实际执行
|
|
299
|
+
--config, -c TEXT 自定义配置文件路径
|
|
300
|
+
--verbose 详细输出模式
|
|
301
|
+
--quiet, -q 静默模式
|
|
302
|
+
--help 显示帮助信息
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### history 命令
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
neosec history [OPTIONS]
|
|
309
|
+
|
|
310
|
+
选项:
|
|
311
|
+
--limit, -n INTEGER 显示最近 N 条记录 (默认: 10)
|
|
312
|
+
--workflow, -w TEXT 筛选工作流名称
|
|
313
|
+
--help 显示帮助信息
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
## 内置模板
|
|
317
|
+
|
|
318
|
+
- `sequential_workflow` - 基础顺序执行工作流
|
|
319
|
+
- `sequential_workflow_v2` - 带超时和重试的顺序执行
|
|
320
|
+
- `conditional_web_workflow` - 条件执行 Web 扫描
|
|
321
|
+
- `conditional_service_workflow` - 根据服务类型条件执行
|
|
322
|
+
- `parallel_workflow` - 并行执行多个侦察任务
|
|
323
|
+
- `data_passing_workflow` - 步骤间数据传递示例
|
|
324
|
+
|
|
325
|
+
## 自定义工具集成
|
|
326
|
+
|
|
327
|
+
Neosec 支持集成任何命令行工具。只需在模板中指定工具路径和参数:
|
|
328
|
+
|
|
329
|
+
```json
|
|
330
|
+
{
|
|
331
|
+
"id": "custom_scan",
|
|
332
|
+
"tool": "/path/to/your/tool.sh",
|
|
333
|
+
"args": {
|
|
334
|
+
"target": "{{target}}",
|
|
335
|
+
"--option": "value"
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
建议自定义工具输出 JSON 格式以支持数据传递:
|
|
341
|
+
|
|
342
|
+
```json
|
|
343
|
+
{
|
|
344
|
+
"status": "success",
|
|
345
|
+
"data": {
|
|
346
|
+
"key": "value"
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
## 开发
|
|
352
|
+
|
|
353
|
+
### 运行测试
|
|
354
|
+
|
|
355
|
+
```bash
|
|
356
|
+
poetry run pytest
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### 代码格式化
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
poetry run black src/
|
|
363
|
+
poetry run ruff check src/
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
## 贡献
|
|
367
|
+
|
|
368
|
+
欢迎贡献!请遵循以下步骤:
|
|
369
|
+
|
|
370
|
+
1. Fork 本仓库
|
|
371
|
+
2. 创建特性分支 (`git checkout -b feature/amazing-feature`)
|
|
372
|
+
3. 提交更改 (`git commit -m 'Add amazing feature'`)
|
|
373
|
+
4. 推送到分支 (`git push origin feature/amazing-feature`)
|
|
374
|
+
5. 开启 Pull Request
|
|
375
|
+
|
|
376
|
+
## 许可证
|
|
377
|
+
|
|
378
|
+
本项目采用 MIT 许可证 - 详见 [LICENSE](LICENSE) 文件
|
|
379
|
+
|
|
380
|
+
## 致谢
|
|
381
|
+
|
|
382
|
+
- [Typer](https://typer.tiangolo.com/) - 优秀的 CLI 框架
|
|
383
|
+
- [Rich](https://rich.readthedocs.io/) - 美观的终端输出库
|
|
384
|
+
|
|
385
|
+
## 联系方式
|
|
386
|
+
|
|
387
|
+
如有问题或建议,请提交 [Issue](https://github.com/Neobee714/neosec/issues)
|
|
388
|
+
|