Skip to content

Commit

Permalink
nmap_vuln.py
Browse files Browse the repository at this point in the history
  • Loading branch information
nforsg committed Aug 16, 2023
1 parent 6ac927c commit 63bd4a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Optional, List, Dict, Any
from typing import Optional, List, Dict, Any, Union
from csle_common.dao.emulation_observation.common.emulation_vulnerability_observation_state import \
EmulationVulnerabilityObservationState
from csle_common.dao.emulation_config.transport_protocol import TransportProtocol
Expand Down Expand Up @@ -38,7 +38,9 @@ def to_obs(self) -> EmulationVulnerabilityObservationState:
:return: the created VulnerabilityObservationState
"""
service = ""
service: Optional[str] = ""
if self.credentials is None:
raise ValueError("self.credentials is None")
if len(self.credentials) > 0:
service = self.credentials[0].service
vuln = EmulationVulnerabilityObservationState(name=self.name, port=self.port, protocol=self.protocol,
Expand Down Expand Up @@ -74,7 +76,7 @@ def to_dict(self) -> Dict[str, Any]:
:return: a dict representation of the object
"""
d = {}
d: Dict[str, Any] = {}
d["name"] = self.name
d["port"] = self.port
d["protocol"] = self.protocol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class EmulationVulnerabilityObservationState(JSONSerializable):

def __init__(self, name: str, port: Union[int, None],
protocol: TransportProtocol, cvss: float, osvdbid: Optional[int] = None,
description: Optional[str] = None, credentials: Optional[List[Credential]] = None, service: str = ""):
description: Optional[str] = None, credentials: Optional[List[Credential]] = None, service: Optional[str] = ""):
"""
Initializes the DTO
Expand Down

0 comments on commit 63bd4a7

Please sign in to comment.