diff --git a/pontos/nvd/models/cpe.py b/pontos/nvd/models/cpe.py index 994fe46d7..4cad14c1d 100644 --- a/pontos/nvd/models/cpe.py +++ b/pontos/nvd/models/cpe.py @@ -17,10 +17,9 @@ from dataclasses import dataclass, field from datetime import datetime -from enum import Enum from typing import List, Optional -from pontos.models import Model +from pontos.models import Model, StrEnum __all__ = ( "DeprecatedBy", @@ -45,7 +44,7 @@ class Title(Model): lang: str -class ReferenceType(Enum): +class ReferenceType(StrEnum): """ A CPE reference type diff --git a/pontos/nvd/models/cve.py b/pontos/nvd/models/cve.py index 2131627bc..203c2ddbd 100644 --- a/pontos/nvd/models/cve.py +++ b/pontos/nvd/models/cve.py @@ -17,10 +17,9 @@ from dataclasses import dataclass, field from datetime import date, datetime -from enum import Enum from typing import List, Optional -from pontos.models import Model +from pontos.models import Model, StrEnum from pontos.nvd.models.cvss_v2 import CVSSData as CVSSv2Data from pontos.nvd.models.cvss_v3 import CVSSData as CVSSv3Data @@ -41,7 +40,7 @@ ) -class CVSSType(Enum): +class CVSSType(StrEnum): """ The CVSS Type: primary or secondary @@ -182,7 +181,7 @@ class VendorComment(Model): last_modified: datetime -class Operator(Enum): +class Operator(StrEnum): """ An operator: AND or OR diff --git a/pontos/nvd/models/cvss_v2.py b/pontos/nvd/models/cvss_v2.py index 6dfcf7499..a6cd5e375 100644 --- a/pontos/nvd/models/cvss_v2.py +++ b/pontos/nvd/models/cvss_v2.py @@ -16,43 +16,42 @@ # along with this program. If not, see . from dataclasses import dataclass -from enum import Enum from typing import Optional -from pontos.models import Model +from pontos.models import Model, StrEnum -class Severity(Enum): +class Severity(StrEnum): LOW = "LOW" MEDIUM = "MEDIUM" HIGH = "HIGH" -class AccessVector(Enum): +class AccessVector(StrEnum): NETWORK = "NETWORK" ADJACENT_NETWORK = "ADJACENT_NETWORK" LOCAL = "LOCAL" -class AccessComplexity(Enum): +class AccessComplexity(StrEnum): HIGH = "HIGH" MEDIUM = "MEDIUM" LOW = "LOW" -class Authentication(Enum): +class Authentication(StrEnum): MULTIPLE = "MULTIPLE" SINGLE = "SINGLE" NONE = "NONE" -class Impact(Enum): +class Impact(StrEnum): NONE = "NONE" PARTIAL = "PARTIAL" COMPLETE = "COMPLETE" -class Exploitability(Enum): +class Exploitability(StrEnum): UNPROVEN = "UNPROVEN" PROOF_OF_CONCEPT = "PROOF_OF_CONCEPT" FUNCTIONAL = "FUNCTIONAL" @@ -60,7 +59,7 @@ class Exploitability(Enum): NOT_DEFINED = "NOT_DEFINED" -class RemediationLevel(Enum): +class RemediationLevel(StrEnum): OFFICIAL_FIX = "OFFICIAL_FIX" TEMPORARY_FIX = "TEMPORARY_FIX" WORKAROUND = "WORKAROUND" @@ -68,14 +67,14 @@ class RemediationLevel(Enum): NOT_DEFINED = "NOT_DEFINED" -class ReportConfidence(Enum): +class ReportConfidence(StrEnum): UNCONFIRMED = "UNCONFIRMED" UNCORROBORATED = "UNCORROBORATED" CONFIRMED = "CONFIRMED" NOT_DEFINED = "NOT_DEFINED" -class CollateralDamagePotential(Enum): +class CollateralDamagePotential(StrEnum): NONE = "NONE" LOW = "LOW" LOW_MEDIUM = "LOW_MEDIUM" @@ -84,7 +83,7 @@ class CollateralDamagePotential(Enum): NOT_DEFINED = "NOT_DEFINED" -class TargetDistribution(Enum): +class TargetDistribution(StrEnum): NONE = "NONE" LOW = "LOW" MEDIUM = "MEDIUM" @@ -92,7 +91,7 @@ class TargetDistribution(Enum): NOT_DEFINED = "NOT_DEFINED" -class Requirement(Enum): +class Requirement(StrEnum): LOW = "LOW" MEDIUM = "MEDIUM" HIGH = "HIGH" diff --git a/pontos/nvd/models/cvss_v3.py b/pontos/nvd/models/cvss_v3.py index f740d535f..58b154ddc 100644 --- a/pontos/nvd/models/cvss_v3.py +++ b/pontos/nvd/models/cvss_v3.py @@ -16,13 +16,12 @@ # along with this program. If not, see . from dataclasses import dataclass -from enum import Enum from typing import Optional -from pontos.models import Model +from pontos.models import Model, StrEnum -class Severity(Enum): +class Severity(StrEnum): NONE = "NONE" LOW = "LOW" MEDIUM = "MEDIUM" @@ -30,14 +29,14 @@ class Severity(Enum): CRITICAL = "CRITICAL" -class AttackVector(Enum): +class AttackVector(StrEnum): NETWORK = "NETWORK" ADJACENT_NETWORK = "ADJACENT_NETWORK" LOCAL = "LOCAL" PHYSICAL = "PHYSICAL" -class ModifiedAttackVector(Enum): +class ModifiedAttackVector(StrEnum): NETWORK = "NETWORK" ADJACENT_NETWORK = "ADJACENT_NETWORK" LOCAL = "LOCAL" @@ -45,66 +44,66 @@ class ModifiedAttackVector(Enum): NOT_DEFINED = "NOT_DEFINED" -class AttackComplexity(Enum): +class AttackComplexity(StrEnum): HIGH = "HIGH" LOW = "LOW" -class ModifiedAttackComplexity(Enum): +class ModifiedAttackComplexity(StrEnum): HIGH = "HIGH" LOW = "LOW" NOT_DEFINED = "NOT_DEFINED" -class PrivilegesRequired(Enum): +class PrivilegesRequired(StrEnum): HIGH = "HIGH" LOW = "LOW" NONE = "NONE" -class ModifiedPrivilegesRequired(Enum): +class ModifiedPrivilegesRequired(StrEnum): HIGH = "HIGH" LOW = "LOW" NONE = "NONE" NOT_DEFINED = "NOT_DEFINED" -class UserInteraction(Enum): +class UserInteraction(StrEnum): NONE = "NONE" REQUIRED = "REQUIRED" -class ModifiedUserInteraction(Enum): +class ModifiedUserInteraction(StrEnum): NONE = "NONE" REQUIRED = "REQUIRED" NOT_DEFINED = "NOT_DEFINED" -class Scope(Enum): +class Scope(StrEnum): UNCHANGED = "UNCHANGED" CHANGED = "CHANGED" -class ModifiedScope(Enum): +class ModifiedScope(StrEnum): UNCHANGED = "UNCHANGED" CHANGED = "CHANGED" NOT_DEFINED = "NOT_DEFINED" -class Impact(Enum): +class Impact(StrEnum): NONE = "NONE" LOW = "LOW" HIGH = "HIGH" -class ModifiedImpact(Enum): +class ModifiedImpact(StrEnum): NONE = "NONE" LOW = "LOW" HIGH = "HIGH" NOT_DEFINED = "NOT_DEFINED" -class ExploitCodeMaturity(Enum): +class ExploitCodeMaturity(StrEnum): UNPROVEN = "UNPROVEN" PROOF_OF_CONCEPT = "PROOF_OF_CONCEPT" FUNCTIONAL = "FUNCTIONAL" @@ -112,7 +111,7 @@ class ExploitCodeMaturity(Enum): NOT_DEFINED = "NOT_DEFINED" -class RemediationLevel(Enum): +class RemediationLevel(StrEnum): OFFICIAL_FIX = "OFFICIAL_FIX" TEMPORARY_FIX = "TEMPORARY_FIX" WORKAROUND = "WORKAROUND" @@ -120,14 +119,14 @@ class RemediationLevel(Enum): NOT_DEFINED = "NOT_DEFINED" -class Confidence(Enum): +class Confidence(StrEnum): UNKNOWN = "UNKNOWN" REASONABLE = "REASONABLE" CONFIRMED = "CONFIRMED" NOT_DEFINED = "NOT_DEFINED" -class Requirement(Enum): +class Requirement(StrEnum): LOW = "LOW" MEDIUM = "MEDIUM" HIGH = "HIGH"