|
| 1 | +class VulnerabilityData: |
| 2 | + |
| 3 | + def _map_severity(self, severity): |
| 4 | + severity_mapping = { |
| 5 | + "CRITICAL": "Critical", |
| 6 | + "HIGH": "High", |
| 7 | + "MEDIUM": "Medium", |
| 8 | + "LOW": "Low", |
| 9 | + "NEGLIGIBLE": "Informational", |
| 10 | + } |
| 11 | + |
| 12 | + return severity_mapping.get(severity, "Informational") |
| 13 | + |
| 14 | + """ |
| 15 | + Data class to represent the Sysdig data extracted from sources like CSV or JSON. |
| 16 | + """ |
| 17 | + def __init__(self): |
| 18 | + self.vulnerability_type: str = "" |
| 19 | + self.class_id: str = "" |
| 20 | + self.kingdom: str = "" |
| 21 | + self.analyzer_name: str = "" |
| 22 | + self.default_severity: str = "" |
| 23 | + |
| 24 | + self.instance_id: str = "" |
| 25 | + self.instance_severity: str = "" |
| 26 | + self.confidence: str = "" |
| 27 | + |
| 28 | + self.source_location_path: str = "" |
| 29 | + self.source_location_line: str = "" |
| 30 | + self.source_location_line_end: str = "" |
| 31 | + self.source_location_col_start: str = "" |
| 32 | + self.source_location_col_end: str = "" |
| 33 | + self.snippet_id: str = "" |
| 34 | + |
| 35 | + |
| 36 | +class SnippetData: |
| 37 | + def __init__(self): |
| 38 | + self.file_name: str = "" |
| 39 | + self.start_line: str = "" |
| 40 | + self.end_line: str = "" |
| 41 | + self.text: str = "" |
| 42 | + |
| 43 | + |
| 44 | +class DescriptionData: |
| 45 | + def __init__(self): |
| 46 | + self.abstract: str = "" |
| 47 | + self.explanation: str = "" |
| 48 | + self.recommendations: str = "" |
| 49 | + self.tips: str = "" |
| 50 | + self.references: str = "" # TODO: parse this? |
| 51 | + |
| 52 | + |
| 53 | +class RuleData: |
| 54 | + def __init__(self): |
| 55 | + self.accuracy: str = "" |
| 56 | + self.impact: str = "" |
| 57 | + self.probability: str = "" |
| 58 | + self.impact_bias: str = "" |
| 59 | + self.confidentiality_impact: str = "" |
| 60 | + self.integrity_impact: str = "" |
| 61 | + self.remediation_effort: str = "" |
0 commit comments