init commit
This commit is contained in:
30
app/utils/models.py
Normal file
30
app/utils/models.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from __future__ import annotations
|
||||
from dataclasses import dataclass, field
|
||||
from typing import List, Optional
|
||||
|
||||
|
||||
@dataclass
|
||||
class PortFinding:
|
||||
"""
|
||||
A single discovered port on a host.
|
||||
protocol: 'tcp' or 'udp'
|
||||
state: 'open', 'closed', 'filtered', 'open|filtered', etc.
|
||||
service: optional nmap-reported service name (e.g., 'ssh', 'http')
|
||||
"""
|
||||
port: int
|
||||
protocol: str
|
||||
state: str
|
||||
service: Optional[str] = None
|
||||
|
||||
|
||||
@dataclass
|
||||
class HostResult:
|
||||
"""
|
||||
Results for a single host.
|
||||
address: IP address (e.g., '192.0.2.10')
|
||||
host: primary hostname if reported by nmap (may be None)
|
||||
ports: list of PortFinding instances for this host
|
||||
"""
|
||||
address: str
|
||||
host: Optional[str] = None
|
||||
ports: List[PortFinding] = field(default_factory=list)
|
||||
Reference in New Issue
Block a user