Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Update backend/utils/pdf_generator.py
Browse files
backend/utils/pdf_generator.py
CHANGED
|
@@ -29,7 +29,7 @@ from cryptography.hazmat.backends import default_backend
|
|
| 29 |
from reportlab.lib import colors
|
| 30 |
from reportlab.lib.pagesizes import letter
|
| 31 |
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
|
| 32 |
-
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak, Image
|
| 33 |
from reportlab.graphics.shapes import Drawing
|
| 34 |
from reportlab.graphics.charts.barcharts import VerticalBarChart
|
| 35 |
|
|
@@ -1062,7 +1062,26 @@ def generate_scan_pdf(scan, vulnerabilities):
|
|
| 1062 |
|
| 1063 |
# Legal Disclaimer & Confidentiality Notice
|
| 1064 |
elements.append(PageBreak())
|
| 1065 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1066 |
disclaimer_body = (
|
| 1067 |
"<b>1. Nature of Automated Security Assessment (\"AS-IS\" Provision)</b><br/>"
|
| 1068 |
"This vulnerability assessment report is completely system-generated by the LarShield automated engine. "
|
|
@@ -1086,16 +1105,16 @@ def generate_scan_pdf(scan, vulnerabilities):
|
|
| 1086 |
"This report contains sensitive, proprietary vulnerability intelligence regarding the client organization's digital assets. "
|
| 1087 |
"Unauthorized distribution, public exposure, or reproduction of this document without prior written authorization from both the client organization and LarShield is strictly prohibited."
|
| 1088 |
)
|
| 1089 |
-
disclaimer_table = Table([[disclaimer_heading], [Paragraph(disclaimer_body,
|
| 1090 |
disclaimer_table.setStyle(TableStyle([
|
| 1091 |
('BACKGROUND', (0,0), (-1,-1), colors.HexColor("#F8FAFC")),
|
| 1092 |
('GRID', (0,0), (-1,-1), 0.5, colors.HexColor("#CBD5E1")),
|
| 1093 |
-
('TOPPADDING', (0,0), (-1,-1),
|
| 1094 |
-
('BOTTOMPADDING', (0,0), (-1,-1),
|
| 1095 |
('LEFTPADDING', (0,0), (-1,-1), 12),
|
| 1096 |
('RIGHTPADDING', (0,0), (-1,-1), 12),
|
| 1097 |
]))
|
| 1098 |
-
elements.append(disclaimer_table)
|
| 1099 |
elements.append(Spacer(1, 15))
|
| 1100 |
|
| 1101 |
return elements
|
|
|
|
| 29 |
from reportlab.lib import colors
|
| 30 |
from reportlab.lib.pagesizes import letter
|
| 31 |
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
|
| 32 |
+
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak, Image, KeepTogether
|
| 33 |
from reportlab.graphics.shapes import Drawing
|
| 34 |
from reportlab.graphics.charts.barcharts import VerticalBarChart
|
| 35 |
|
|
|
|
| 1062 |
|
| 1063 |
# Legal Disclaimer & Confidentiality Notice
|
| 1064 |
elements.append(PageBreak())
|
| 1065 |
+
|
| 1066 |
+
disclaimer_title_style = ParagraphStyle(
|
| 1067 |
+
'DisclaimerTitleStyle',
|
| 1068 |
+
parent=styles['Heading3'],
|
| 1069 |
+
fontSize=11,
|
| 1070 |
+
leading=14,
|
| 1071 |
+
textColor=colors.HexColor("#0F172A"),
|
| 1072 |
+
spaceAfter=6
|
| 1073 |
+
)
|
| 1074 |
+
|
| 1075 |
+
disclaimer_body_style = ParagraphStyle(
|
| 1076 |
+
'DisclaimerBodyStyle',
|
| 1077 |
+
parent=styles['Normal'],
|
| 1078 |
+
fontSize=8,
|
| 1079 |
+
leading=10.5,
|
| 1080 |
+
textColor=colors.HexColor("#334155"),
|
| 1081 |
+
alignment=4
|
| 1082 |
+
)
|
| 1083 |
+
|
| 1084 |
+
disclaimer_heading = Paragraph("<b>Legal Disclaimer, Scope Boundaries & Limitation of Liability</b>", disclaimer_title_style)
|
| 1085 |
disclaimer_body = (
|
| 1086 |
"<b>1. Nature of Automated Security Assessment (\"AS-IS\" Provision)</b><br/>"
|
| 1087 |
"This vulnerability assessment report is completely system-generated by the LarShield automated engine. "
|
|
|
|
| 1105 |
"This report contains sensitive, proprietary vulnerability intelligence regarding the client organization's digital assets. "
|
| 1106 |
"Unauthorized distribution, public exposure, or reproduction of this document without prior written authorization from both the client organization and LarShield is strictly prohibited."
|
| 1107 |
)
|
| 1108 |
+
disclaimer_table = Table([[disclaimer_heading], [Paragraph(disclaimer_body, disclaimer_body_style)]], colWidths=[460])
|
| 1109 |
disclaimer_table.setStyle(TableStyle([
|
| 1110 |
('BACKGROUND', (0,0), (-1,-1), colors.HexColor("#F8FAFC")),
|
| 1111 |
('GRID', (0,0), (-1,-1), 0.5, colors.HexColor("#CBD5E1")),
|
| 1112 |
+
('TOPPADDING', (0,0), (-1,-1), 10),
|
| 1113 |
+
('BOTTOMPADDING', (0,0), (-1,-1), 10),
|
| 1114 |
('LEFTPADDING', (0,0), (-1,-1), 12),
|
| 1115 |
('RIGHTPADDING', (0,0), (-1,-1), 12),
|
| 1116 |
]))
|
| 1117 |
+
elements.append(KeepTogether(disclaimer_table))
|
| 1118 |
elements.append(Spacer(1, 15))
|
| 1119 |
|
| 1120 |
return elements
|