mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-03 04:07:52 +00:00
lf_pcap.py: roam time and destination address unction added
This commit is contained in:
@@ -76,25 +76,27 @@ class LfPcap(Realm):
|
||||
return self.pcap
|
||||
|
||||
def read_time(self, pcap_file,
|
||||
filter='(wlan.fixed.auth.alg == 2 && wlan.fixed.status_code == 0x0000 && wlan.fixed.auth_seq == 0x0001)'):
|
||||
filter='(wlan.fc.type_subtype==3 && wlan.tag.number==55) && (wlan.da == 04:f0:21:9f:c1:69)'):
|
||||
try:
|
||||
if pcap_file is not None:
|
||||
cap = self.read_pcap(pcap_file=pcap_file, apply_filter=filter)
|
||||
packet_count = 0
|
||||
data = []
|
||||
for pkt in cap:
|
||||
x = pkt.frame_info.time_relative
|
||||
y = float(x)
|
||||
z = round(y, 4)
|
||||
m = z * 1000
|
||||
data.append(m)
|
||||
packet_count += 1
|
||||
print("Total Packets: ", packet_count)
|
||||
# print(data)
|
||||
if packet_count != 0:
|
||||
return data
|
||||
else:
|
||||
return data
|
||||
data = None
|
||||
for pkt, s in zip(cap, range(2)):
|
||||
if s == 0:
|
||||
x = pkt.frame_info.time_relative
|
||||
y = float(x)
|
||||
z = round(y, 4)
|
||||
m = z * 1000
|
||||
data = m
|
||||
print(data)
|
||||
packet_count += 1
|
||||
print("Total Packets: ", packet_count)
|
||||
# print(data)
|
||||
if packet_count != 0:
|
||||
return data
|
||||
else:
|
||||
return data
|
||||
except ValueError:
|
||||
raise "pcap file is required"
|
||||
|
||||
@@ -337,6 +339,26 @@ class LfPcap(Realm):
|
||||
report_location=current_path,
|
||||
report_dir=updated_path)
|
||||
|
||||
def get_destination_add(self, pcap_file, filter='(wlan.fc.type_subtype==3 && wlan.tag.number==55)'):
|
||||
""" To get status code of each packet in WLAN MGT Layer """
|
||||
print("pcap file path: %s" % pcap_file)
|
||||
try:
|
||||
if pcap_file is not None:
|
||||
cap = self.read_pcap(pcap_file=pcap_file, apply_filter=filter)
|
||||
packet_count = 0
|
||||
value, data = '', []
|
||||
for pkt in cap:
|
||||
# print("hii///",pkt)
|
||||
data.append(str(pkt.wlan.da))
|
||||
print(data)
|
||||
packet_count += 1
|
||||
print("Total Packets: ", packet_count)
|
||||
if packet_count != 0:
|
||||
return data
|
||||
else:
|
||||
return data
|
||||
except ValueError:
|
||||
raise "pcap file is required"
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
@@ -378,7 +400,8 @@ see: /py-scritps/lf_pcap.py
|
||||
# pcap_obj.check_beamformer_beacon_frame(pcap_file=pcap_obj.pcap_file)
|
||||
# pcap_obj.get_wlan_mgt_status_code(pcap_file=pcap_obj.pcap_file)
|
||||
# pcap_obj.get_packet_info(pcap_obj.pcap_file)
|
||||
pcap_obj.read_time(pcap_file="roam_11r_ota_iteration_0_2022-05-05-22-20.pcap")
|
||||
pcap_obj.read_time(pcap_file="roam_11r_ota_iteration_0_2022-05-25-09-31.pcap")
|
||||
# pcap_obj.get_destination_add(pcap_file="roam_11r_ota_iteration_0_2022-05-25-09-31.pcap")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user