From: Michael Tremer Date: Sun, 14 Sep 2025 11:14:47 +0000 (+0000) Subject: generator: Make the host clearer on the title page X-Git-Tag: 0.3~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e36dbc9f1658c2d3a68e73e83c2bdf509cfa0f1b;p=suricata-reporter.git generator: Make the host clearer on the title page Signed-off-by: Michael Tremer --- diff --git a/src/suricata-report-generator.in b/src/suricata-report-generator.in index 7913a4e..8c985c0 100644 --- a/src/suricata-report-generator.in +++ b/src/suricata-report-generator.in @@ -91,6 +91,14 @@ class ReportGenerator(object): for style in ("Normal", "Title", "Heading1", "Heading2"): self.styles[style].fontName = "Prompt" + # Create a subtitle style + subtitle = reportlab.lib.styles.ParagraphStyle( + name = "Subtitle", + parent = self.styles["Title"], + fontSize = 14, + ) + self.styles.add(subtitle) + # Allow to center content centered = reportlab.lib.styles.ParagraphStyle( name = "Centered", @@ -202,6 +210,9 @@ class ReportGenerator(object): """ date_format = "%d %B %Y" + # Fetch the hostname + hostname = socket.gethostname() + # What time is it right now? now = datetime.datetime.now() @@ -213,6 +224,11 @@ class ReportGenerator(object): _("IPFire Intrusion Prevention Alert Report"), self.styles["Title"], )) + # Show the hostname + elements.append(reportlab.platypus.Paragraph( + hostname, self.styles["Subtitle"], + )) + # Only show one date if this is a daily report if date_start == date_end: elements.append( @@ -235,15 +251,12 @@ class ReportGenerator(object): ) # Leave some extra space - elements.append(reportlab.platypus.Spacer(1, 1 * cm)) + elements.append(reportlab.platypus.Spacer(1, 10 * cm)) # Show when this report was generated and on which host elements.append( reportlab.platypus.Paragraph( - _("Generated on %(hostname)s on %(when)s.") % { - "hostname" : socket.gethostname(), - "when" : now.strftime("%d %B %Y %H:%M"), - }, + _("Generated %s") % now.strftime("%d %B %Y %H:%M"), self.styles["Centered"], ), )