MCPcopy Create free account
hub / github.com/TheSecuredAnalyst/security-suite / ReportGenerator

Class ReportGenerator

modules/ai/reporter.py:27–417  ·  view source on GitHub ↗

Generate professional security reports.

Source from the content-addressed store, hash-verified

25class ReportGenerator:
26 """Generate professional security reports."""
27
28 def __init__(self):
29 self.logger = get_logger("ai.reporter")
30 self.correlator = FindingCorrelator()
31
32 def generate_html(
33 self,
34 scan_results: list[ScanResult],
35 config: ReportConfig | None = None,
36 ai_analysis: str | None = None,
37 ) -> str:
38 """Generate HTML report.
39
40 Args:
41 scan_results: List of scan results
42 config: Report configuration
43 ai_analysis: Optional AI-generated analysis to include
44
45 Returns:
46 HTML report string
47 """
48 config = config or ReportConfig()
49 correlation = self.correlator.correlate(scan_results)
50
51 # Build severity color map
52 severity_colors = {
53 "critical": "#dc3545",
54 "high": "#fd7e14",
55 "medium": "#ffc107",
56 "low": "#17a2b8",
57 "info": "#6c757d",
58 }
59
60 html = f"""<!DOCTYPE html>
61<html lang="en">
62<head>
63 <meta charset="UTF-8">
64 <meta name="viewport" content="width=device-width, initial-scale=1.0">
65 <title>{config.title}</title>
66 <style>
67 * {{ margin: 0; padding: 0; box-sizing: border-box; }}
68 body {{ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
69 line-height: 1.6; color: #333; background: #f5f5f5; }}
70 .container {{ max-width: 1200px; margin: 0 auto; padding: 20px; }}
71 .header {{ background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); color: white;
72 padding: 40px; margin-bottom: 30px; border-radius: 10px; }}
73 .header h1 {{ font-size: 2.5em; margin-bottom: 10px; }}
74 .header .meta {{ opacity: 0.8; }}
75 .card {{ background: white; border-radius: 10px; padding: 25px; margin-bottom: 20px;
76 box-shadow: 0 2px 10px rgba(0,0,0,0.1); }}
77 .card h2 {{ color: #1a1a2e; margin-bottom: 20px; padding-bottom: 10px;
78 border-bottom: 2px solid #eee; }}
79 .risk-score {{ display: inline-block; padding: 15px 30px; border-radius: 10px;
80 font-size: 2em; font-weight: bold; color: white; }}
81 .risk-critical {{ background: #dc3545; }}
82 .risk-high {{ background: #fd7e14; }}
83 .risk-medium {{ background: #ffc107; color: #333; }}
84 .risk-low {{ background: #17a2b8; }}

Callers 2

report_htmlFunction · 0.90
report_jsonFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected