Refactor environment variable loading to improve error handling and clarity
This commit is contained in:
parent
fa0a1fd930
commit
0e49e636ce
1 changed files with 8 additions and 2 deletions
10
listener.py
10
listener.py
|
@ -6,9 +6,15 @@ from collections import defaultdict
|
|||
from scapy.all import sniff, Dot11, RadioTap
|
||||
from dotenv import dotenv_values
|
||||
|
||||
# === Load ENV ===
|
||||
config = dotenv_values(os.path.expanduser("~/wifi_test/settings.env"))
|
||||
settings_path = os.path.expanduser("~/wifi_test/settings.env")
|
||||
config = dotenv_values(settings_path)
|
||||
|
||||
if not config:
|
||||
print(f"[!] Failed to load settings from {settings_path}")
|
||||
exit(1)
|
||||
|
||||
LISTEN_INTERFACE = config.get("LISTEN_INTERFACE", "wlan0")
|
||||
print(f"[+] Using LISTEN_INTERFACE = {LISTEN_INTERFACE}")
|
||||
|
||||
# === Globals ===
|
||||
clients_per_channel = defaultdict(set)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue