Architecture - baeziy/AWSault GitHub Wiki
Architecture
Project structure
src/awsault/
βββ __init__.py version string
βββ __main__.py python -m awsault entry point
βββ cli.py CLI argument parsing, scan orchestration, terminal output
βββ services.py service registry (120+ AWS services, 500+ API calls)
βββ core/
β βββ __init__.py
β βββ creds.py credential loading, validation, region discovery
β βββ scanner.py surface scan engine with concurrency and pagination
β βββ store.py local result persistence (~/.awsault/)
βββ recon/
β βββ __init__.py
β βββ deep.py deep enumeration chains (11) + privesc detection (14)
β βββ audit.py security finding detection (16 rules)
β βββ loot.py secret and credential extraction (7 sources)
β βββ suggestions.py context-aware next-step commands (240+ across 121 services)
βββ output/
βββ __init__.py
βββ formatters.py JSON, CSV, and HTML export
Data flow
βββββββββββββββββββββββββββ
β cli.py β
β (argument parsing, β
β orchestration, β
β terminal output) β
ββββββββββ¬βββββββββββββββββ
β
βββββββββββββββΌββββββββββββββ
β β β
v v v
ββββββββββββ ββββββββββββ ββββββββββββββββ
β creds.py β βservices.pyβ β store.py β
β β β β β β
β load β β service β β save/load β
β session β β registry β β last_scan β
β validate β β API defs β β .json β
ββββββ¬ββββββ βββββββ¬ββββββ ββββββββββββββββ
β β
v v
ββββββββββββββββββββββββββ
β scanner.py β
β β
β ThreadPoolExecutor β
β 500+ API calls β
β pagination β
β error classification β
ββββββββββββ¬βββββββββββββ
β
β quick_results
β
ββββββββββββββΌβββββββββββββββββ
β β β
v v v
ββββββββββββ ββββββββββββ ββββββββββββ
β deep.py β β audit.py β β loot.py β
β β β β β β
β 11 chainsβ β 16 rules β β 7 sourcesβ
β privesc β β findings β β secrets β
β identity β β β β β
ββββββ¬ββββββ ββββββ¬ββββββ ββββββ¬ββββββ
β β β
ββββββββββββββΌβββββββββββββββ
β
v
ββββββββββββββββ
βformatters.py β
β β
β JSON / CSV β
β HTML report β
ββββββββββββββββ
Module responsibilities
cli.py β Orchestrator
The CLI is the only module that imports from all others. It:
- Parses command-line arguments
- Routes to the appropriate command handler (
scan,show,export,list-services) - Orchestrates the 5-phase scan pipeline
- Formats terminal output using the
richlibrary - Builds the export payload and calls formatters
- Generates suggested next steps from recon data
services.py β Service Registry
A pure data module. Contains the definition of every AWS service AWSault can scan:
- Boto3 client name
- Whether it's global or regional
- List of API calls with method names, response keys, pagination support, and fixed parameters
No logic β just data. Adding a new service means adding a dict entry.
core/creds.py β Credential Manager
Wraps boto3 session creation and validation:
load_session()creates a boto3 Session with optional profile and regionvalidate()callssts:GetCallerIdentityto confirm credentials workget_enabled_regions()queries EC2 for the list of enabled regions
core/scanner.py β Surface Scanner
The concurrent scan engine:
- Takes a dict of service targets from the service registry
- Spins up a ThreadPoolExecutor
- Fires each API call as a separate task
- Handles pagination via boto3 paginators
- Classifies errors (denied vs. real errors)
- Returns structured results per service
core/store.py β Persistence
Simple file-based storage:
- Saves scan results as JSON to
~/.awsault/last_scan.json - Loads previous results for
--showand--output - Handles the
~/.awsault/directory creation
recon/deep.py β Deep Enumerator
Contains 11 enumeration chains plus the identity recon engine:
- Each chain is a function taking
(session, quick_results)and returning enriched data - Chains run in parallel via ThreadPoolExecutor
- The
chain_iam_selfchain is the most complex β it builds the full identity permission map and runs privilege escalation detection - Contains the
_PRIVESC_TECHNIQUESregistry and_detect_privesc()scanner
recon/audit.py β Security Auditor
Contains 16 detection rules:
- Each rule is a function taking
(quick_results, deep_results, findings_list) - Rules append
Findingobjects with severity, service, resource, title, detail, and recommendation run_audit()runs all rules and returns findings sorted by severity
recon/loot.py β Loot Extractor
Contains 7 extraction functions:
- Each function takes a boto3
sessionand returns a list of extracted items - Functions run in parallel via ThreadPoolExecutor
- Returns a dict mapping source names to item lists
output/formatters.py β Report Generator
Three export functions:
save_json()β full JSON dumpsave_csv()β flat CSV with section headerssave_html()β self-contained HTML with embedded CSS/JS, dark theme, interactive tabs
Key design decisions
Decoupled formatters
Formatters accept plain dicts, not internal objects. This keeps them independent of the scanner's data structures.
Parallel everything
Surface scan, deep chains, and loot extractors all run in thread pools. Each task is independent β one failure doesn't block others.
Read-only by default
All API calls are read-only. The only "active" calls are GetSecretValue and GetParameter in loot mode, which read (not write) data.
No external services
AWSault makes no network calls except to AWS APIs. No telemetry, no update checks, no phone home.
Single-file HTML
The HTML report is completely self-contained β CSS and JavaScript are inline. No CDN dependencies, no external assets. Works offline.
Adding new components
See Extending AWSault for step-by-step guides on adding:
- New services to the registry
- New deep enumeration chains
- New security audit rules
- New loot extraction sources