pip install -r requirements.txt
这是一个基于 LangGraph/ LangChain 的通用 CTF 渗透测试 Agent,支持工具调用闭环;也提供 LoRA(PEFT)+ REINFORCE 的远程训练流程。
- 启动环境 RPC 服务(默认监听
0.0.0.0:8010): 运行:python env_rpc_server.py - 启动本地 OpenAI 兼容推理服务(用于“大Q”/监督,默认
0.0.0.0:8001): 运行:python lora/http_server.py如需指定 LoRA 适配器:PEFT_ADAPTER_PATH=/path/to/adapter python lora/http_server.py - 运行训练:
python train_rl_agent_remote.py --env-url http://127.0.0.1:8010 --target <CTF目标URL> --episodes 24
训练产物:runs/peft_rl_remote*/ep_*/(LoRA 权重+分词器),并写入 metrics.jsonl。
命令一:python Agent.py -t <CTF目标URL> --use-supervisor on(默认开启本地“大Q”监督)
命令二:python Agent.py -t <CTF目标URL> --use-supervisor off
也可直接运行 Web/工具图版本:
python AgentwithWeb.py -t <CTF目标URL>
运行时请通过
.env或环境变量配置远端模型与本地监督服务地址(例如DEEPSEEK_API_KEY、REMOTE_WORKER_API_BASE、LOCAL_LLM_API_BASE等)。
pip install -r requirements.txt
This is a general-purpose CTF penetration testing agent built on LangGraph/LangChain, with closed-loop tool calling. It also provides a remote training pipeline based on LoRA (PEFT) + REINFORCE.
-
Start the environment RPC service (listening on
0.0.0.0:8010by default):python env_rpc_server.py
-
Start the local OpenAI-compatible inference service (used as the "supervisor" / guidance model, listening on
0.0.0.0:8001by default):python lora/http_server.py
If you need to specify a LoRA adapter:
PEFT_ADAPTER_PATH=/path/to/adapter python lora/http_server.py
-
Run training:
python train_rl_agent_remote.py --env-url http://127.0.0.1:8010 --target <CTF target URL> --episodes 24
Training artifacts are saved under runs/peft_rl_remote*/ep_*/ (LoRA weights + tokenizer), and metrics are written to metrics.jsonl.
Command 1:
python Agent.py -t <CTF target URL> --use-supervisor on(Local supervisor enabled by default)
Command 2:
python Agent.py -t <CTF target URL> --use-supervisor offYou can also run the Web / tool-graph version directly:
python AgentwithWeb.py -t <CTF target URL>At runtime, configure the remote model and local supervisor service addresses via
.envor environment variables, such asDEEPSEEK_API_KEY,REMOTE_WORKER_API_BASE, andLOCAL_LLM_API_BASE.