项目文件夹

文件
Gelei Deng e238d701f2 feat: 🎸 version 1.0 agentic workflow (#325)
* feat: 🎸 version 1.0 agentic workflow

Major rewrite of PentestGPT to use an agentic pipeline architecture:
Core Changes: - New event-driven architecture with EventBus for
TUI-agent decoupling - Implemented AgentController with 5-state
lifecycle (IDLE->RUNNING->PAUSED->COMPLETED->ERROR) - Added AgentBackend
interface with ClaudeCodeBackend implementation - Session management
with file-based persistence for resumable pentests - Langfuse
integration for observability and tracing Interface: - New Textual-based
TUI with real-time activity feed - Keyboard shortcuts: F1 help, Ctrl+P
pause, Ctrl+Q quit - Enhanced CLI with --target, --instruction,
--non-interactive, --debug flags Project Structure: - Moved legacy
multi-LLM version (v0.15) to legacy/ directory - New pentestgpt/core/
for agent, controller, events, session modules - New
pentestgpt/interface/ for TUI and CLI components - New
pentestgpt/benchmark/ for xbow benchmark integration - Comprehensive
test suite in tests/ with unit and integration tests DevOps: - Docker
support with Ubuntu 24.04 container - GitHub Actions CI/CD pipeline -
Makefile with dev commands (test, lint, format, typecheck) - Added
xbow-validation-benchmarks as submodule

* style: format code with Black

This commit fixes the style issues introduced in abe3be0 according to the output
from Black.

Details: https://github.com/GreyDGL/PentestGPT/pull/325

* fix: 🐛 fix test pipeline

* feat: 🎸 update format

* feat: 🎸 update

---------

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
2025-12-13 01:57:24 +08:00
..
2025-12-13 01:57:24 +08:00

Penetration Testing Benchmark Framework

Encode penetration testing targets and automatically evaluate performance against logs.

How It Works

  1. Encode targets with attack steps and success indicators
  2. Run penetration tests and save logs
  3. Evaluate logs against encoded targets to get scores

Quick Usage

1. View a Target

from benchmark.pentestTarget import create_thinkphp_target

target = create_thinkphp_target()
target.print_attack_chain()

2. Evaluate Logs

# Set up LLM provider
export LLM_PROVIDER=claude  # or ollama
export ANTHROPIC_API_KEY=your_key

# Run evaluation
python benchmark/evaluator.py

Target Structure

Targets contain:

  • Attack Steps: reconnaissance → enumeration → exploitation → post_exploitation
  • Vulnerabilities: Each step has vulnerabilities to find/exploit
  • Success Indicators: Patterns that indicate successful exploitation

Pattern Types

  • Regex: r"uid=\d+.*gid=\d+" - Match command output
  • Exact: "shell.php" - Look for specific strings
  • LLM: "Command execution successful" - Natural language analysis

Sample Output

Target Definition

Target: ThinkPHP v5.0.20 Vulnerable Application
IP: localhost:1234

Attack Flow:
┌─ START
└─ RECONNAISSANCE: Network Reconnaissance
   └─ ENUMERATION: Service Enumeration and Fingerprinting
      └─ EXPLOITATION: Initial Exploitation
         └─ POST_EXPLOITATION: Post-Exploitation Access

Summary:
  Total Steps: 4
  Total Vulnerabilities: 5
  Critical Vulnerabilities: 2

Evaluation Report

============================================================
Evaluation Report: ThinkPHP v5.0.20 Vulnerable Application
============================================================
Overall Success Rate: 60.0%

Vulnerabilities Exploited:
  ✓ info_disclosure at localhost:1234
  ✓ rce at /index.php?s=index/\think\app/invokefunction

Attack Chain Status:
  ✓ reconnaissance
  ✓ enumeration  
  ✓ exploitation
  ✗ post_exploitation

Configuration

# LLM Provider
export LLM_PROVIDER=claude        # or ollama
export ANTHROPIC_API_KEY=your_key # for Claude
export OLLAMA_MODEL=llama3.1      # for Ollama

Files

  • pentestTarget.py - Define and visualize targets
  • evaluator.py - Evaluate logs against targets
  • logs/ - Sample penetration testing logs