Environment:0xSteph Pentest ai aiohttp
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, HTTP |
| Last Updated | 2026-10-23 14:00 GMT |
Overview
aiohttp >= 3.9 async HTTP client environment required by oracle verification, capsule replay, and probe execution modules that perform live HTTP requests during engagement verification.
Description
This environment provides the aiohttp async HTTP client library used by pentest-ai's verification and probing subsystems. The `Verifier.verify_candidate` and `stamp_oracle_verdicts` functions create `aiohttp.ClientSession` instances to re-run exploit attempts against live targets. Oracle builders in `engine/oracles.py` use the session to perform differential privilege checks, replay attacks, and OAST callback verification.
aiohttp is a core dependency (not optional) because verification is the heart of pentest-ai's "earned verdict" philosophy — every finding must be re-proven against the live target before it is surfaced as verified.
Usage
Use this environment when:
- Running oracle verification that makes live HTTP requests (differential, replay, OAST)
- Replaying proof capsules against a target
- Executing MCP probe tools that perform HTTP requests
- Running chain capsule build and replay operations
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux, macOS, Windows | Same as Environment:0xSteph_Pentest_ai_Python_3_10_Plus |
| Hardware | Any modern CPU | Network I/O bound, not CPU bound |
| Network | Target must be reachable | Verification requires live HTTP access to the engagement target |
Dependencies
System Packages
- Python >= 3.10 (see Environment:0xSteph_Pentest_ai_Python_3_10_Plus)
Python Packages
- `aiohttp` >= 3.9
Credentials
No additional credentials. Targets are accessed using credentials captured during the engagement (stored in `WorkingMemory.captured_auth`).
Quick Install
# aiohttp is a core dependency; included in the base install
pip install -e .
Code Evidence
aiohttp dependency from `pyproject.toml:51`:
"aiohttp>=3.9",
aiohttp session usage in `engine/verifier.py:238-245`:
import aiohttp
async with aiohttp.ClientSession() as session:
for finding in findings:
oracle = build_oracle_from_finding(finding, session, intensity)
if oracle is None:
continue
receipt = await verifier.verify_candidate(
engagement_id=engagement_id,
finding_id=fid,
oracle=oracle,
)
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `aiohttp.ClientConnectorError` | Target unreachable or connection refused | Verify target is in scope and reachable; check network/firewall |
| `TimeoutError during oracle verify` | Target slow to respond | Increase tool timeout via ScanProfile or reduce intensity |
| `RuntimeError: Session is closed` | aiohttp session used after `async with` exit | Ensure all oracle calls happen inside the `async with aiohttp.ClientSession()` block |
Compatibility Notes
- Proxy support: Respects `PTAI_UPSTREAM_PROXY` env var for proxy-routed verification requests.
- Scope enforcement: All aiohttp requests in oracle paths are subject to ScopeEnforcer checks; out-of-scope requests are blocked before the session sends them.
- Async-only: aiohttp is used exclusively in async contexts (`async def`); synchronous callers must use `httpx` or `requests` instead.
Related Pages
- Implementation:0xSteph_Pentest_ai_build_oracle_from_finding
- Implementation:0xSteph_Pentest_ai_build_capsule
- Implementation:0xSteph_Pentest_ai_replay_capsule
- Implementation:0xSteph_Pentest_ai_build_chain_capsule
- Implementation:0xSteph_Pentest_ai_AgentOrchestrator_start_engagement
- Implementation:0xSteph_Pentest_ai_run_probe_mcp
- Implementation:0xSteph_Pentest_ai_http_request_mcp
- Implementation:0xSteph_Pentest_ai_Auth_Session_WebAuthenticator
- Implementation:0xSteph_Pentest_ai_CVE_DB