Skip to content

Commit

Permalink
Remove unnecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
nmasdoufi-ol committed Dec 3, 2024
1 parent 043b4e0 commit a7eaf3c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 15 deletions.
12 changes: 0 additions & 12 deletions agent/nmap_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,6 @@ def __init__(
self._scope_domain_regex: Optional[str] = self.args.get("scope_domain_regex")
self._vpn_config: Optional[str] = self.args.get("vpn_config")
self._dns_config: Optional[str] = self.args.get("dns_config")
self._ipv6_cidr_limit: int = int(
self.args.get("ipv6_cidr_limit", IPV6_CIDR_LIMIT)
)

def _validate_ipv6_settings(self) -> None:
"""Validate IPv6-specific settings."""
max_mask = int(self.args.get("max_network_mask_ipv6", "128"))
if max_mask < IPV6_MIN_PREFIX or max_mask > 128:
raise ValueError(f"IPv6 prefix must be between {IPV6_MIN_PREFIX} and 128")

def start(self) -> None:
if self._vpn_config is not None and self._dns_config is not None:
Expand Down Expand Up @@ -177,8 +168,6 @@ def process(self, message: msg.Message) -> None:
logger.error("Neither host or domain are set.")

def _scan_host(self, host: str, mask: int) -> Tuple[Dict[str, Any], str]:
is_ipv6 = ":" in host # Simple check for IPv6 address

options = nmap_options.NmapOptions(
dns_resolution=False,
ports=self.args.get("ports"),
Expand All @@ -190,7 +179,6 @@ def _scan_host(self, host: str, mask: int) -> Tuple[Dict[str, Any], str]:
scripts=self.args.get("scripts"),
script_default=self.args.get("script_default", False),
version_detection=self.args.get("version_info", False),
ipv6_enabled=is_ipv6,
)

client = nmap_wrapper.NmapWrapper(options)
Expand Down
3 changes: 0 additions & 3 deletions agent/nmap_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ class NmapOptions:
)
no_ping: bool = True
privileged: Optional[bool] = None
ipv6_enabled: bool = False

def _set_os_detection_option(self) -> List[str]:
"""Appends the os detection option to the list of nmap options."""
Expand Down Expand Up @@ -156,8 +155,6 @@ def _run_scripts_command(self, scripts: List[str]) -> List[str]:
def command_options(self) -> List[str]:
"""Computes the list of nmap options."""
command_options = []
if self.ipv6_enabled is True:
command_options.append("-6")
command_options.extend(self._set_os_detection_option())
command_options.extend(self._set_version_detection_option())
command_options.extend(self._set_dns_resolution_option())
Expand Down

0 comments on commit a7eaf3c

Please sign in to comment.