Let's start using pcaps.
This commit is contained in:
parent
1ed992e1d4
commit
ec2bbc43a4
2 changed files with 31 additions and 3 deletions
|
@ -45,6 +45,30 @@ def get_clients_on_ap(capture, ap_bssid):
|
|||
|
||||
return len(clients)
|
||||
|
||||
def get_clients_on_channel(capture, ap_channel, ap_bssid):
|
||||
clients = set()
|
||||
ap_bssid = ap_bssid.lower() # Normalize for comparison
|
||||
ap_channel = str(ap_channel) # Ensure channel is a string for comparison
|
||||
|
||||
for packet in capture:
|
||||
try:
|
||||
if not hasattr(packet, 'wlan'):
|
||||
continue
|
||||
|
||||
channel = getattr(packet.wlan, 'channel', None)
|
||||
sa = getattr(packet.wlan, 'sa', '').lower()
|
||||
da = getattr(packet.wlan, 'da', '').lower()
|
||||
bssid = getattr(packet.wlan, 'bssid', '').lower()
|
||||
|
||||
# Check if the packet is on the specified channel and not from the AP
|
||||
if channel == ap_channel and (sa != ap_bssid and da != ap_bssid):
|
||||
clients.add(sa)
|
||||
clients.add(da)
|
||||
|
||||
except AttributeError:
|
||||
continue
|
||||
|
||||
return len(clients)
|
||||
|
||||
def analyze_pcap(pcapng_path, start_ts, end_ts, ap_bssid, ap_channel):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue