import html import json from pathlib import Path MANUAL_STEPS = ["Confirm application and business owners and obtain retirement approval.", "Review historical monitoring, DNS, load balancers, backups and firewall logs.", "Validate service accounts, scheduled workloads and SMB/NFS/Samba consumers with owners.", "Resolve failed or missing checks and verify rollback and retention requirements."] def export_json(path, data, assessment): Path(path).write_text(json.dumps({"inventory_result": data, "assessment": assessment}, indent=2), encoding="utf-8") def export_html(path, data, assessment): escape = lambda value: html.escape(str(value)) content = "
SYNTHETIC DEMO — no real collection performed.
" if data["synthetic"] else "IMPORTED INVENTORY — source assertions not independently verified.
" if not data['synthetic'] and data['server'].get('collection_source') == 'Local Linux read-only collection': content = 'LOCAL LINUX INVENTORY — read-only snapshot of the execution host.
' content += "Heuristic requiring administrator review. This report does not authorize retirement.
" content += f"Risk: {escape(assessment['level'])} ({assessment['score']}/100)
" for title, value in [("Server overview", data["server"]), ("Collection timestamp", data["collected_at"]), ("Inventory", data["inventory"]), ("Dependencies and risk findings", assessment["findings"]), ("Collection checks / missing evidence", data["checks"])]: content += f"{escape(json.dumps(value, indent=2))}"
content += "