PDFReportGenerator class, which creates detailed security audit documentation with custom styling and structured sections.
PDFReportGenerator Class
Location:reporter/pdf_generator.py
The report generator creates comprehensive PDF documents that include all findings from the security audit.
Initialization
- Generates a timestamp for the report
- Creates the output filename in format:
REPORT_{ip}_{timestamp}.pdf - Initializes ReportLab styles
- Creates custom paragraph styles
Report Structure
The PDF report follows a standardized structure with 10 main sections:1. Cover Page
Displays key information about the audit target:- Report title: “INFORME DE AUDITORÍA DE SEGURIDAD INFORMÁTICA”
- Framework version
- Target IP address
- Operating system detection
- Risk level
- Analysis date
- Number of open ports
- Number of vulnerabilities
- Number of extracted credentials
2. Index
Table of contents with all 10 sections listed.3. Executive Summary
High-level overview including:- Audit scope and target
- Key findings summary
- Vulnerability counts by severity (critical, high, medium)
- Overall risk level assessment
- Number of exposed services and directories
4. Methodology
Describes the audit phases:- Phase 1 - Reconnaissance: Nmap scanning, OS detection, directory enumeration
- Phase 2 - Brute Force (WordPress): WPScan user enumeration and password attacks
- Phase 3 - SQL Injection: SQLMap detection and exploitation on DVWA
- Phase 4 - Risk Analysis: Global risk evaluation
- Phase 5 - Report: Documentation and recommendations
5. Tools Used
Table of all security tools with versions:- Kali Linux
- Nmap (port/service scanning)
- SQLMap (SQL injection)
- WPScan (WordPress auditing)
- Gobuster/Dirb (directory enumeration)
- Python 3 (automation framework)
- ReportLab (PDF generation)
6. Scanning Phase (Reconnaissance)
6.1 OS Detection- Detected operating system with accuracy percentage
- Target IP confirmation
- Table with all open ports
- Columns: Port, State, Service, Version
- Color-coded by state
- Table of discovered web directories
- Columns: Directory, HTTP Code, Accessibility
- Shows up to 20 directories
7. Brute Force Phase (WordPress)
- WPScan enumeration process
- User discovery results
- Plugin vulnerability detection
- Brute force attack results with rockyou.txt
- Extracted credentials table
8. SQL Injection Phase (DVWA)
- DVWA login process
- SQLMap injection testing
- Database dump results
- MD5 hash extraction
- Table of dumped credentials
9. Extracted Credentials
Critical section displaying all compromised credentials:- Table columns: Source, User, Password/Hash, Cracked status
- Impact analysis
- Access implications
10. Risk Analysis
8.1 Risk Summary Table- Severity levels: CRITICAL, HIGH, MEDIUM, LOW
- Vulnerability counts per level
- Color-coded backgrounds
- Numbered list of all findings
- Each entry includes:
- Risk level (color-coded)
- Vulnerability name
- Description
- Recommendations
11. Security Recommendations
Prioritized table of remediation steps:- CRITICAL: WordPress updates, prepared statements, password changes
- HIGH: 2FA implementation, WAF deployment
- MEDIUM: MySQL access restrictions, rate limiting
- LOW: Periodic audits, log monitoring
12. Conclusions
Final assessment including:- Overall security posture
- Key findings summary
- Urgency of recommended actions
- Ethical hacking disclosure
Color Scheme
The report uses a consistent color palette defined inpdf_generator.py:14-18:
Custom Styles
The report defines 7 custom paragraph styles:| Style | Font Size | Use Case |
|---|---|---|
CoverTitle | 24pt | Report cover page |
CoverSubtitle | 14pt | Framework version, metadata |
SectionTitle | 16pt | Main section headers |
SubSection | 12pt | Subsection headers |
BodyText | 10pt | Standard paragraphs |
AlertCritical | 10pt | Critical vulnerability warnings |
AlertSuccess | 10pt | Positive security findings |
Generated Filename Format
The PDF report is saved with a standardized naming convention:reporter/pdf_generator.py:25
Report Generation
To generate the complete report:Conditional Content
The report adapts based on findings:When No Vulnerabilities Found
Sections display success messages in green:When Vulnerabilities Detected
Sections display critical alerts in red:Tables and Formatting
All tables use consistent styling:- Header row: dark background (#1a1a2e) with white text
- Alternating row colors for readability
- Grid lines in light gray (#cccccc)
- Proper padding for cells
Dependencies
Required ReportLab imports:Output Location
All PDF reports are saved to:pdf_generator.py:607):