Skip to content

Commit

Permalink
add uuid feature
Browse files Browse the repository at this point in the history
  • Loading branch information
aormu authored and rlxdev committed Jan 9, 2025
1 parent 484e88d commit 035ab5a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
10 changes: 7 additions & 3 deletions scubagoggles/orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import os
import platform
import shutil
import uuid
import webbrowser

from datetime import datetime, timezone
Expand Down Expand Up @@ -273,7 +274,7 @@ def _run_reporter(self):

timestamp_utc = datetime.now(timezone.utc)
timestamp_zulu = timestamp_utc.strftime('%Y-%m-%dT%H:%M:%S.%f')[:-3] + 'Z'

report_uuid = str(uuid.uuid4())
report_metadata = {
'TenantId': None,
'DisplayName': None,
Expand All @@ -283,7 +284,8 @@ def _run_reporter(self):
'ProductAbbreviationMapping': product_abbreviation_mapping,
'Tool': 'ScubaGoggles',
'ToolVersion': Version.number,
'TimeStampZulu': timestamp_zulu
'TimeStampZulu': timestamp_zulu,
'ReportUUID': report_uuid
}

total_output.update({'MetaData': report_metadata})
Expand Down Expand Up @@ -341,7 +343,9 @@ def _run_reporter(self):
'Details': self._generate_summary(stats[0])})

fragments.append(Reporter.create_html_table(table_data))
front_page_html = Reporter.build_front_page_html(fragments, tenant_info)
front_page_html = Reporter.build_front_page_html(fragments,
tenant_info,
report_uuid)
report_path.write_text(front_page_html, encoding = 'utf-8')

# suppress opening the report in the browser
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ <h1>SCuBA GWS Secure Configuration Baseline Reports</h1>
{{TABLE}}
<footer>
Report generated with <a class="individual_reports" href="https://github.com/cisagov/ScubaGoggles">CISA's ScubaGoggles</a> tool {{VERSION}}
<p><span class="alignRight">Report UUID: {{report_uuid}}</span></p>
</footer>
</main>
</body>
Expand Down
8 changes: 6 additions & 2 deletions scubagoggles/reporter/reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,11 @@ def create_html_table(table_data: list) -> str:
return table_html

@classmethod
def build_front_page_html(cls, fragments: list, tenant_info: dict) -> str:
def build_front_page_html(cls,
fragments: list,
tenant_info: dict,
report_uuid: str) -> str:

"""
Builds the Front Page Report using the HTML Report Template
Expand All @@ -172,7 +176,7 @@ def build_front_page_html(cls, fragments: list, tenant_info: dict) -> str:
front_css_file = cls._reporter_path / 'styles/FrontPageStyle.css'
css = front_css_file.read_text(encoding = 'utf-8')
html = html.replace('{{FRONT_CSS}}', f'<style>{css}</style>')

html = html.replace('{{report_uuid}}', report_uuid)
html = html.replace('{{TABLE}}', table)

now = datetime.now()
Expand Down
13 changes: 10 additions & 3 deletions scubagoggles/reporter/styles/FrontPageStyle.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ a.individual_reports:active {
font-family: Arial, Helvetica, sans-serif;
color: #85B065;
text-decoration: none;
}
}

table.tenantdata tr:first-child {
color: black;
Expand All @@ -51,6 +51,13 @@ table.tenantdata tr:first-child {
.manual { background-color: var(--test-other); }

.error {
background-color: #deb8b8;
background-color: #deb8b8;
color: #d10000;
}
}

.alignRight {
text-align: right;
color: grey;
font-size: 80%;

}

0 comments on commit 035ab5a

Please sign in to comment.