""" Dataclass for ports from NMAP result
"""

from dataclasses import dataclass, field


@dataclass(unsafe_hash=True, order=True)
class NmapPort:
    """ NMAP port details from result

    Attributes:
        service     name of service running on port
        port        port number
        state       state of port according to NMAP
        protocol    tcp/udp
        product     product name according to NMAP
        tunnel      if service is tunneled through SSL
        open        (bool) if port is considered open for DAQ results/testing
    """
    sort_index: int = field(init=False, repr=False)
    service: str
    port: int
    state: str
    protocol: str
    product: str
    tunnel: str
    open: bool

    def __post_init__(self):
        self.sort_index = int(self.port)

""" Dataclass for ports from NMAP result
"""

from dataclasses import dataclass, field


@dataclass(unsafe_hash=True, order=True)
class NmapPort:
    """ NMAP port details from result

    Attributes:
        service     name of service running on port
        port        port number
        state       state of port according to NMAP
        protocol    tcp/udp
        product     product name according to NMAP
        tunnel      if service is tunneled through SSL
        open        (bool) if port is considered open for DAQ results/testing
    """
    sort_index: int = field(init=False, repr=False)
    service: str
    port: int
    state: str
    protocol: str
    product: str
    tunnel: str
    open: bool

    def __post_init__(self):
        self.sort_index = int(self.port)

Dataclass for ports from NMAP result NMAP port details from result      Attributes:         service     name of service running on port         port        port number         state       state of port according to NMAP         protocol    tcp/udp         product     product name according to NMAP         tunnel      if service is tunneled through SSL         open        (bool) if port is considered open for DAQ results/testing