Overview
The Ethical Audit Framework follows a modular architecture with clear separation of concerns. The system orchestrates multiple security tools through a unified audit engine, collecting and analyzing results to generate comprehensive security reports.Project Structure
The framework is organized into the following directory structure:Module Responsibilities
Entry Point: main.py
Provides an interactive Rich-based CLI menu with the following capabilities:- Full audit execution (all attack vectors)
- Network discovery with automated targeting
- Individual attack module execution
- Custom target specification
main.py
Core Orchestrator: audit_engine.py
TheAuditEngine class coordinates the entire audit workflow through six sequential phases. It maintains the central Host object that accumulates findings from all modules.
Configuration: config.py
Centralizes all configuration constants:config.py
Data Models: models/
Host Model (host.py)
The central data structure that aggregates all audit findings:models/host.py
Vulnerability Model (vuln.py)
Defines vulnerability structure and risk levels:models/vuln.py
Attack Services: services/
Each service module follows a consistent pattern:- Initialize with target
Hostobject - Execute external security tools
- Parse tool output
- Return findings as
Vulnerabilityor credential objects
| Service | Tool | Purpose |
|---|---|---|
NmapScanner | Nmap | Port scanning, service detection, OS fingerprinting |
GobusterEnum | Gobuster | Web directory enumeration |
SQLMapInjector | SQLMap | SQL injection detection and exploitation |
WPForceBrute | WPScan | WordPress vulnerability scanning and brute force |
HashCracker | Hashcat/John | Password hash cracking |
RiskAnalyzer | Custom | Risk scoring algorithm |
Report Generation: reporter/
ThePDFReportGenerator creates professional audit reports with:
- Executive summary with risk assessment
- Detailed methodology documentation
- Phase-by-phase findings breakdown
- Extracted credentials table
- Prioritized security recommendations
- Evidence file references
Data Flow Pipeline
The audit follows this sequential data flow:Detailed Flow
- Initialization:
AuditEngine(target_ip)creates engine instance - Phase 1 (Reconnaissance):
NmapScannercreatesHostobject with ports and services - Phase 2 (Enumeration):
GobusterEnumadds discovered directories toHost.directories - Phase 3 (SQL Injection):
SQLMapInjectorappends vulnerabilities and credentials - Phase 4 (WordPress):
WPForceBruteadds WP-specific findings - Phase 5 (Cracking):
HashCrackerattempts to crack extracted password hashes - Phase 6 (Risk Analysis):
RiskAnalyzercalculates overall risk score - Report Generation:
PDFReportGeneratorcompiles all findings into PDF
Each phase operates on the same
Host instance, progressively enriching it with new findings. This allows later phases to leverage information discovered by earlier ones.Integration with External Tools
The framework integrates with external security tools through subprocess execution and output parsing:Nmap Integration
services/nmap_scanner.py
SQLMap Integration
The framework automates DVWA login, sets security level, and executes SQLMap against vulnerable endpoints:WPScan Integration
Output Directory Structure
All audit artifacts are saved to theoutputs/ directory:
Error Handling and Resilience
The architecture implements defensive programming:- Tool failures don’t crash audits: Each phase wraps tool execution in try/except blocks
- Graceful degradation: Missing data is handled with defaults (e.g.,
getattr(host, 'directories', [])) - Output validation: Tool outputs are validated before parsing to prevent crashes on unexpected formats
Performance Considerations
- Sequential execution: Phases run sequentially as each depends on previous results
- Network-bound: Performance primarily limited by network latency and target response time
- Tool parallelization: Some tools (WPScan) support
--max-threadsfor concurrent operations - Disk I/O: All evidence files are written to disk for report generation and forensic purposes
Extension Points
The architecture supports easy extension:- New attack modules: Add to
services/and integrate inaudit_engine.py - Custom vulnerability types: Extend
Vulnerabilityclass with additional fields - Alternative report formats: Implement new reporters alongside
PDFReportGenerator - Risk scoring algorithms: Modify
RiskAnalyzer.analyze()logic