other
- Location
checkers/network_checker.py:24- Finding
Out-of-Scope Runtime Network and Environment Reconnaissance
- Content
View full analysis
bool: try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.settimeout(self.timeout) result = sock.connect_ex((host, port)) sock.close() return result == 0 except Exception: return False def scan_common_ports(self, host: str) -> Dict[int, str]: open_ports = {} for port in self.common_ports: if self.check_port_open(host, port): service_name = self._get_service_name(port) open_ports[port] = service_name return open_ports ``` It also executes operating-system utilities to enumerate firewall state and probe arbitrary hosts: ```python if system == 'windows': result = subprocess.run( ['netsh', 'advfirewall', 'show', 'allprofiles'], capture_output=True, text=True, timeout=self.timeout ) elif system == 'linux': try: result = subprocess.run( ['iptables', '-L'], capture_output=True, text=True, timeout=self.timeout ) except FileNotFoundError: try: result = subprocess.run( ['ufw', 'status'], capture_output=True, text=True, timeout=self.timeout ) except FileNotFoundError: pass ``` ```python def check_network_connectivity(self, target_hosts: List[str]) -> Dict[str, bool]: ...[truncated 4861 chars]- Remediation
View remediation
