| 1 | from typing import List |
| 2 | from typing import Optional |
| 3 | |
| 4 | from pydantic import BaseModel |
| 5 | from pydantic import Field |
| 6 | |
| 7 | |
| 8 | class EpssThreatIntelRequest(BaseModel): |
| 9 | cve: str = Field( |
| 10 | ..., |
| 11 | description="The CVE to evaluate.", |
| 12 | ) |
| 13 | |
| 14 | |
| 15 | class EpssData(BaseModel): |
| 16 | cve: str |
| 17 | epss: str |
| 18 | percentile: str |
| 19 | date: str |
| 20 | |
| 21 | |
| 22 | class EpssApiResponse(BaseModel): |
| 23 | status: str |
| 24 | status_code: int |
| 25 | version: str |
| 26 | access_control_allow_headers: Optional[str] = None |
| 27 | access: str |
| 28 | total: int |
| 29 | offset: int |
| 30 | limit: int |
| 31 | data: List[EpssData] |
| 32 | |
| 33 | def to_dict(self): |
| 34 | return self.model_dump() |
| 35 | |
| 36 | |
| 37 | class EpssThreatIntelResponse(BaseModel): |
| 38 | data: Optional[List[EpssData]] = Field(None, description="The data for the IoC") |
| 39 | success: bool = Field(..., description="Indicates if it was successful") |
| 40 | message: str = Field(None, description="Message about the IoC") |
| 41 | the_epss_model: str = Field( |
| 42 | "https://www.first.org/epss/model", |
| 43 | description="The EPSS model description", |
| 44 | ) |