import shutil import subprocess DEPENDENCIES = def check_installed(tool) -> bool: """Check if tcpdump is installed and available on the system path.""" return shutil.which(f'{tool}') is not None def ensure_installed(tool): """Ensure that tcpdump is installed, raise an error if not.""" if not check_installed(tool): raise RuntimeError("tcpdump is not installed. Please install it to continue.") def list_interfaces() -> str: """List available network interfaces using tcpdump.""" ensure_installed() try: result = subprocess.run(['tcpdump', '--list-interfaces'], capture_output=True, text=True, check=True) return result.stdout except subprocess.CalledProcessError as e: print(f"Failed to list interfaces: {e}") return "" def start_tcpdump(): return None