(self, shared_data)
| 128 | This class handles the entire network scanning process. |
| 129 | """ |
| 130 | def __init__(self, shared_data): |
| 131 | self.shared_data = shared_data |
| 132 | self.logger = logger |
| 133 | self.displaying_csv = shared_data.displaying_csv |
| 134 | self.blacklistcheck = shared_data.blacklistcheck |
| 135 | self.mac_scan_blacklist = shared_data.mac_scan_blacklist |
| 136 | self.ip_scan_blacklist = shared_data.ip_scan_blacklist |
| 137 | self.console = Console() if Console else None |
| 138 | self.lock = threading.Lock() |
| 139 | self.currentdir = shared_data.currentdir |
| 140 | # CRITICAL: Pi Zero W2 has limited resources - use conservative thread count |
| 141 | # 512MB RAM, 4 cores @ 1GHz can only handle a few concurrent operations |
| 142 | cpu_count = os.cpu_count() or 1 |
| 143 | # Limit concurrent socket operations aggressively on the Pi Zero 2 W |
| 144 | self.port_scan_workers = max(2, min(6, cpu_count)) |
| 145 | self.host_scan_workers = max(2, min(6, cpu_count)) |
| 146 | self.semaphore = threading.Semaphore(min(4, max(1, cpu_count // 2 or 1))) |
| 147 | self.nm = nmap.PortScanner() if nmap else None # Initialize nmap.PortScanner() |
| 148 | self.running = False |
| 149 | self.arp_scan_interface = self._detect_default_interface() |
| 150 | self._active_scan_network = None |
| 151 | # Initialize SQLite database manager |
| 152 | self.db = get_db(currentdir=self.currentdir) |
| 153 | |
| 154 | @staticmethod |
| 155 | def _detect_default_interface(): |
nothing calls this directly
no test coverage detected