Implementation:0xSteph Pentest ai HTTP Identity
| Knowledge Sources | |
|---|---|
| Domains | HTTP, User_Agent, Identity |
| Last Updated | 2026-10-23 00:00 GMT |
Overview
Concrete tool for generating branded HTTP User-Agent strings, stable install IDs, and request IDs for pentest-ai HTTP traffic, provided by the pentest-ai engine.
Description
The http_identity module provides stable per-machine install IDs, branded User-Agent strings, and request IDs for all outgoing HTTP traffic. The install_id is a 12-char hex stored in ~/.pentest-ai/install_id. The user_agent function builds a branded UA string with version and install ID. The scan_headers and install_headers functions return header dicts for scan traffic and API calls respectively. A discovery UA variant exists for passive recon.
Usage
Import this module when you need consistent HTTP identity headers for tool wrappers, API calls, or probes. Used by the agent loop and tool registry.
Code Reference
Source Location
- Repository: 0xSteph_Pentest_ai
- File: engine/http_identity.py
- Lines: 1-93
Signature
def package_version() -> str: ...
def install_id() -> str: ...
def request_id() -> str: ...
def user_agent() -> str: ...
def discovery_user_agent() -> str: ...
def install_headers() -> dict[str, str]: ...
def discovery_headers() -> dict[str, str]: ...
def scan_headers(**extra: str) -> dict[str, str]: ...
Import
from engine.http_identity import user_agent, install_id, request_id, scan_headers, install_headers
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| PTAI_INSTALL_ID | str (env) | No | Override install ID |
| PENTEST_AI_CONFIG_DIR | str (env) | No | Override config directory |
| extra | kwargs | No (scan_headers) | Additional headers to include |
Outputs
| Name | Type | Description |
|---|---|---|
| install_id | str | 12-char hex ID, stable per machine |
| user_agent | str | Branded UA string with version and ID |
| headers | dict | Header dict with User-Agent and X-Request-ID |
Usage Examples
Get HTTP Headers for Scanning
from engine.http_identity import scan_headers, user_agent, install_id
print(f"User-Agent: {user_agent()}")
# pentest-ai/1.2.1 (compatible; rv:abc123def456; +https://pentestai.xyz)
print(f"Install ID: {install_id()}") # abc123def456
headers = scan_headers(Accept="application/json")
# {"User-Agent": "pentest-ai/...", "X-Request-ID": "7a3f9c21-...-abc123def456", "Accept": "application/json"}