Fix places where quote replacement lead to issues.

This commit is contained in:
Sebastian Lenzlinger
2024-05-08 02:52:37 +02:00
parent e569eb3e5b
commit 2e95bd2fd2
4 changed files with 14 additions and 8 deletions

View File

@@ -5,18 +5,18 @@ from typing import Optional
def check_installed() -> bool:
'''Check if tcpdump is installed and available on the system path.'''
"""Check if tcpdump is installed and available on the system path."""
return shutil.which('tcpdump') is not None
def ensure_installed():
'''Ensure that tcpdump is installed, raise an error if not.'''
"""Ensure that tcpdump is installed, raise an error if not."""
if not check_installed():
raise RuntimeError('tcpdump is not installed. Please install it to continue.')
def list_interfaces() -> str:
'''List available network interfaces using tcpdump.'''
"""List available network interfaces using tcpdump."""
ensure_installed()
try:
result = subprocess.run(['tcpdump', '--list-interfaces'], capture_output=True, text=True, check=True)