Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:0xSteph Pentest ai WebAgent run assessment

From Leeroopedia
Knowledge Sources
Domains Security_Testing, Web_Application_Testing
Last Updated 2026-10-23 12:00 GMT

Overview

Concrete LLM-driven web application security assessment agent that follows the OWASP Testing Guide methodology with probe-based testing and auth injection.

Description

The WebAgent class runs the web assessment phase of the engagement lifecycle. It follows the OWASP Testing Guide methodology: content discovery, vulnerability scanning, injection testing, authentication/session testing, API discovery, and business logic testing.

When an LLM is configured, the agent reasons about which tools and probes to run. Without an LLM, it falls back to a deterministic probe sweep. The agent supports:

  • Auth injection: Optional auth credentials injected into probe requests
  • Focus areas: Limit testing to specific OWASP areas
  • Context propagation: Receives recon context (open_ports, services) via `set_context()`
  • Probe-based testing: Uses engine.probes.* modules for targeted vulnerability testing

Usage

Import this when you need to:

  • Run the web assessment phase of an engagement
  • Test a web application against OWASP Top 10 categories
  • Perform authenticated web scanning with probe-based testing

Code Reference

Source Location

  • Repository: pentest-ai
  • File: agents/web/web_agent.py

Signature

class WebAgent(BaseAgent):
    agent_type = "web"

    async def run_assessment(
        self,
        target: str,
        auth_credentials: dict[str, str] | None = None,
        focus_areas: list[str] | None = None,
        engagement_id: str = "",
    ) -> dict[str, Any]:
        """Run web application security assessment."""

Import

from agents.web.web_agent import WebAgent

I/O Contract

Inputs

Name Type Required Description
target str Yes Web application URL
auth_credentials None No Optional auth tokens/cookies
focus_areas None No OWASP test areas to limit scope
engagement_id str No For FindingsDB persistence

Outputs

Name Type Description
returns dict[str, Any] findings_count and status; findings persisted to DB

Usage Examples

from agents.web.web_agent import WebAgent
from tools.registry import ToolRegistry

registry = ToolRegistry()
agent = WebAgent(registry, db, llm=my_llm, scope=scope)
agent.set_context(recon_context)  # open_ports, services from recon

result = await agent.run_assessment(
    target="https://app.example.com",
    auth_credentials={"Cookie": "session=abc123"},
    focus_areas=["injection", "auth"],
    engagement_id="eng-123",
)

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment