Update passive_sniff.py

This commit is contained in:
Mert 2026-05-18 21:12:45 +02:00
commit c0261964ae

View file

@ -95,7 +95,6 @@ def get_mac_vendor(mac, ip):
print(f"[+] New Device: {ip} ({mac}) -> Vendor: {vendor}") print(f"[+] New Device: {ip} ({mac}) -> Vendor: {vendor}")
# FIX: Guard against race condition — devices[mac] may not exist if called unexpectedly
device = devices.get(mac) device = devices.get(mac)
hostname = device.get('hostname', '') if device else '' hostname = device.get('hostname', '') if device else ''
log_device(mac, ip, vendor, hostname) log_device(mac, ip, vendor, hostname)
@ -130,7 +129,6 @@ def process_packet(packet):
hostname = opt[1].decode('utf-8') hostname = opt[1].decode('utf-8')
if mac in devices: if mac in devices:
devices[mac]['hostname'] = hostname devices[mac]['hostname'] = hostname
# FIX: Use consistent "Unknown" fallback (was "Bilinmiyor" in Turkish)
log_device(mac, devices[mac]['ip'], mac_vendors.get(mac[:8].upper(), "Unknown"), hostname) log_device(mac, devices[mac]['ip'], mac_vendors.get(mac[:8].upper(), "Unknown"), hostname)
print(f"[*] Device Name: {mac} -> {hostname}") print(f"[*] Device Name: {mac} -> {hostname}")