abdulazeem-tk4vr/smart-soc-agent

GitHub: abdulazeem-tk4vr/smart-soc-agent

一个用于评估 LLM 驱动的 SOC 威胁狩猎工作流的独立调查代理,支持在 SecRL/ExCyTIn-Bench 基准上进行可复现的实验。

Stars: 0 | Forks: 0

# smart-soc-agent 一个独立的 SOC 调查 agent,用于评估 SecRL/ExCyTIn-Bench 上的证据门控威胁狩猎工作流。 ## 兼容性 - 运行时代码自包含于此仓库中,并通过 `smart_soc_agent` 导入。 - Benchmark wrapper 需要将 `secgym` 作为环境依赖安装;它们不会将同级仓库路径添加到 `sys.path` 中。 - Python 代码使用可移植的 `pathlib` 路径,旨在 Windows PowerShell 和 Linux/Ubuntu shell 上运行。 ## 快速检查 Windows PowerShell: ``` python -m pytest tests -q ``` Linux/Ubuntu: ``` python -m pytest tests -q ``` ## SecRL 试验 Wrapper 在当前环境中将 SecRL/ExCyTIn-Bench 安装为 `secgym`,并确保其容器/配置可用后: ``` python scripts/run_trial.py --num_questions 2 --max_steps 15 --layer alert ``` 离线连线检查: ``` python scripts/run_trial.py --num_questions 2 --max_steps 25 --layer alert --offline_eval ``` ## RAG 默认的 `full`/`agentic` 图使用 SOC Defender RAG。当设置了 `SOC_DEFENDER_RAG_URL` 时,它优先使用 HTTP 服务,这是在已经托管 RAG 内容的远程服务器上运行时的预期模式。如果 `data/rag` 下存在本地生成的资源,它也可以使用本地的 Qdrant 向量索引。使用以下命令,关键字检索仍可作为显式 fallback 使用: ``` SMART_SOC_RAG_BACKEND=keyword python scripts/run_eval.py --arms full ``` RAG 语料库、chunks 和 Qdrant 索引是生成/外部产物,刻意不被 git 追踪。要重建本地资源: ``` python scripts/fetch_rag_corpora.py python scripts/build_rag_chunks.py python scripts/build_qdrant_index.py --chunks data/rag/chunks.jsonl --output-dir data/rag/qdrant ``` ## Ollama smart-agent 的 LLM hooks 与托管在 RunPod GPU 上的 Ollama 服务器兼容。设置 Ollama endpoint 和模型,然后启用该后端: ``` export OLLAMA_BASE_URL=https:// export OLLAMA_MODEL=qwen2.5:7b-instruct export SMART_SOC_LLM_BACKEND=ollama python scripts/run_eval.py --arms full --llm_backend ollama ``` endpoint 应该是提供 `/api/generate` 服务的 Ollama base URL。`OLLAMA_BASE_URL` 会自动启用 Ollama 后端;显式的后端标志对于可复现性很有用。使用 `.env.example` 作为本地 RunPod/Ollama 设置的模板,并将实际值保存在被 git 忽略的 `.env` 中。`run_eval.py` 和 `agent_http_server.py` 在 `.env` 存在时会自动加载它。 ## 评估 Frozen-protocol full arm: ``` python scripts/run_eval.py --arms full --max_steps 25 --layer alert --split test --eval_model gpt-4o --cache_seed 131 ``` 消融实验及 baseline: ``` python scripts/run_eval.py --arms all --max_steps 25 --layer alert --split test --eval_model gpt-4o --cache_seed 131 python scripts/analyze_results.py --input_dir final_results --output_dir analysis_results ``` 有关完整的复现说明,请参阅 `REPRODUCE.md`。
标签:AI风险缓解, LLM大模型, Qdrant向量数据库, RAG检索增强生成, SOC调查代理, 安全规则引擎, 安全评估基准, 安全运营, 扫描框架, 逆向工具