| 118 | # ------------------------------------------------------------------ |
| 119 | |
| 120 | def _map_lynis_code(self, code: str) -> Dict[str, Any]: |
| 121 | cis = self.mappings.get("cis", {}) |
| 122 | exact = cis.get("lynis_to_cis", {}) |
| 123 | prefix = cis.get("prefix_to_cis", {}) |
| 124 | if code in exact: |
| 125 | return exact[code] |
| 126 | head = code.split("-", 1)[0] if code else "" |
| 127 | if head in prefix: |
| 128 | return prefix[head] |
| 129 | return {"title": "Unmapped finding (informational)", "controls": ["Unmapped (informational)"]} |
| 130 | |
| 131 | def build_cis_report(self, host: Optional[str] = None) -> Dict[str, Any]: |
| 132 | lynis = self._collect_lynis(host) |