Implementation:0xSteph Pentest ai InstallPreferences
| Knowledge Sources | |
|---|---|
| Domains | Preferences, Persistence, Tool_Installation |
| Last Updated | 2026-10-23 00:00 GMT |
Overview
Concrete tool for persisting user install-prompt preferences so users aren't re-prompted every engagement, provided by the pentest-ai engine.
Description
The InstallPreferences dataclass wraps the preferences JSON at ~/.pentest-ai/install-preferences.json. It tracks auto_install (default False), denied_tools list, approved_methods dict (apt, go, pip, cargo), and last_updated timestamp. The smart-install flow consults this file so users set preferences once. Conservative defaults: always ask in interactive shells, skip silently in non-interactive.
Usage
Import this class when you need to load or save user install preferences. Used by the smart-install flow at engagement start.
Code Reference
Source Location
- Repository: 0xSteph_Pentest_ai
- File: engine/install_preferences.py
- Lines: 1-97
Signature
@dataclass
class InstallPreferences:
auto_install: bool = False
denied_tools: list[str] = field(default_factory=list)
approved_methods: dict[str, bool] = field(default_factory=_default_methods)
last_updated: str | None = None
def deny(self, tool_name: str) -> None: ...
def approve_method(self, method: str) -> None: ...
def save(self, path: Path | None = None) -> None: ...
def load_preferences(path: Path | None = None) -> InstallPreferences: ...
Import
from engine.install_preferences import InstallPreferences, load_preferences
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| path | None | No | Override preferences file path |
Outputs
| Name | Type | Description |
|---|---|---|
| InstallPreferences | dataclass | Loaded preferences with defaults |
Usage Examples
Load and Update Preferences
from engine.install_preferences import load_preferences
prefs = load_preferences()
print(f"Auto-install: {prefs.auto_install}")
print(f"Denied tools: {prefs.denied_tools}")
# User approves pip installs, denies wpscan
prefs.approve_method("pip")
prefs.deny("wpscan")
prefs.save()