From a7eaf3c2f151b2f87d78ff2f92e929e7b1011c90 Mon Sep 17 00:00:00 2001 From: nmasdoufi-ol Date: Tue, 3 Dec 2024 17:57:41 +0100 Subject: [PATCH] Remove unnecessary code --- agent/nmap_agent.py | 12 ------------ agent/nmap_options.py | 3 --- 2 files changed, 15 deletions(-) diff --git a/agent/nmap_agent.py b/agent/nmap_agent.py index e11f3f0..485a148 100644 --- a/agent/nmap_agent.py +++ b/agent/nmap_agent.py @@ -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: @@ -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"), @@ -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) diff --git a/agent/nmap_options.py b/agent/nmap_options.py index 496eb23..3a4c31b 100644 --- a/agent/nmap_options.py +++ b/agent/nmap_options.py @@ -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.""" @@ -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())