项目文件夹

文件
Gelei Deng 577ac294a4 feat: modernize legacy PentestGPT with native multi-LLM support (#469)
Rebuild the classic USENIX-2024 interactive PentestGPT (reasoning / generation /
parsing sessions + Pentesting Task Tree + REPL) as a standalone
`pentestgpt_legacy` package on a native per-provider LLM layer that supports the
latest 2026 models.

- llm/: BaseProvider + OpenAI-compatible / Anthropic / Gemini connectors, a
  web-verified model registry (OpenAI, Anthropic, Gemini, DeepSeek, xAI, Qwen,
  Moonshot, local Ollama), a factory, and an LLMClient bridging async providers
  to the core's synchronous send_new_message/send_message session API.
- CLI `pentestgpt-legacy`: --list-models and --smoke-test (live per-model
  round-trip matrix), plus --reasoning-model / --parsing-model / --base-url.
- Tests: 25 unit tests (mocked, no network). Live smoke test verified 22/22
  models with a configured key respond.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-07 02:18:08 +08:00

143 行
3.6 KiB
TOML

[project]
name = "pentestgpt"
version = "1.0.0"
description = "AI-powered autonomous penetration testing agent - Published at USENIX Security 2024"
authors = [{ name = "Gelei Deng", email = "GELEI.DENG@ntu.edu.sg" }]
readme = "README.md"
license = { text = "MIT" }
requires-python = ">=3.12,<4.0"
keywords = [
"penetration-testing",
"security",
"ai",
"claude",
"pentest",
"cybersecurity",
"ctf",
"hacking",
]
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Topic :: Security",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.12",
]
dependencies = [
"pydantic>=2.5.0",
"pydantic-settings>=2.1.0",
"python-dotenv>=1.0.0",
"langfuse>=2.0.0",
# Modernized legacy PentestGPT: interactive UI + native multi-provider LLM SDKs
"prompt-toolkit>=3.0.0",
"rich>=13.0.0",
"loguru>=0.7.0",
"openai>=1.55.0",
"anthropic>=0.49.0",
"google-genai>=1.0.0",
]
[project.scripts]
pentestgpt = "pentestgpt.interface.main:main"
pentestgpt-legacy = "pentestgpt_legacy.main:main"
pentestgpt-legacy-connection = "pentestgpt_legacy.test_connection:test_connection"
[project.urls]
Homepage = "https://github.com/GreyDGL/PentestGPT"
Repository = "https://github.com/GreyDGL/PentestGPT"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["pentestgpt", "pentestgpt_legacy"]
# ============================================================================
# uv Configuration
# ============================================================================
[tool.uv]
dev-dependencies = [
"ruff>=0.1.0",
"mypy>=1.7.0",
"pytest>=7.4.0",
"pytest-asyncio>=0.21.0",
"pytest-cov>=4.1.0",
]
# ============================================================================
# Ruff Configuration (Linter & Formatter)
# ============================================================================
[tool.ruff]
target-version = "py312"
line-length = 100
extend-exclude = [
".git",
".mypy_cache",
".pytest_cache",
".ruff_cache",
"__pycache__",
"build",
"dist",
]
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # Pyflakes
"I", # isort
"UP", # pyupgrade
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"SIM", # flake8-simplify
"RUF", # Ruff-specific rules
]
ignore = [
"E501", # Line too long (handled by formatter)
]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
# ============================================================================
# MyPy Configuration (Type Checking)
# ============================================================================
[tool.mypy]
python_version = "3.12"
strict = true
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
# Third-party SDKs without complete type stubs (used by pentestgpt_legacy).
[[tool.mypy.overrides]]
module = ["google.genai.*", "google.*"]
ignore_missing_imports = true
# ============================================================================
# Pytest Configuration
# ============================================================================
[tool.pytest.ini_options]
minversion = "7.0"
addopts = [
"--strict-markers",
"--strict-config",
]
testpaths = ["tests"]
pythonpath = ["."]
asyncio_mode = "auto"
markers = [
"unit: Unit tests (fast, no external dependencies)",
"integration: Integration tests (may use mocks)",
"slow: Slow tests (skip with -m 'not slow')",
]