vulnscan / base.py
wuhp's picture
Create base.py
710f1db verified
from dataclasses import dataclass, field
from enum import Enum
from typing import Optional
import httpx
class Severity(str, Enum):
CRITICAL = "critical"
HIGH = "high"
MEDIUM = "medium"
LOW = "low"
INFO = "info"
@dataclass
class Finding:
plugin: str
title: str
severity: Severity
description: str
evidence: dict
owasp: str
cwe: str
remediation: str
endpoint: Optional[str] = None
cvss_estimate: Optional[float] = None
tags: list[str] = field(default_factory=list)
def to_dict(self) -> dict:
return {
"plugin": self.plugin,
"title": self.title,
"severity": self.severity.value,
"description": self.description,
"evidence": self.evidence,
"owasp": self.owasp,
"cwe": self.cwe,
"remediation": self.remediation,
"endpoint": self.endpoint,
"cvss_estimate": self.cvss_estimate,
"tags": self.tags,
}
class VulnerabilityPlugin:
name: str = "base"
description: str = ""
def __init__(self, client: httpx.AsyncClient):
self.client = client
async def run(self, target: str) -> list[Finding]:
raise NotImplementedError