How can I find packet error rate, Channel efficiency and collisions using scapy and python in wifi traffic. I have to do this by data from pcap file. this is how I have opened the pcap file:
file=rdpcap("file1.cap")
thank you
about PER,
there is a bit in the package that treats this. you can reach to it by using:
FCfield & 0x8
Here is an example code (you need to import matplotlib.pyplot as plt
) :
def foo(self):
number_of_pkts = len(self.pcap_file)
retransmission_pkts = 0
for pkt in self.pcap_file:
# cecking if the retransmission flag is on
if (pkt[Dot11].FCfield & 0x8) != 0:
retransmission_pkts += 1
ans = (retransmission_pkts / number_of_pkts)*100
ans = float("%.2f" % ans)
labels = ['Standard packets', 'Retransmitted packets']
sizes = [100.0 - ans,ans]
colors = ['g', 'r']
# Make a pie graph
plt.clf()
plt.figure(num=1, figsize=(8, 6))
plt.axes(aspect=1)
plt.suptitle('Retransmitted packet', fontsize=14, fontweight='bold')
plt.rcParams.update({'font.size': 13})
plt.pie(sizes, labels=labels, autopct='%.2f%%', startangle=60, colors=colors, pctdistance=0.7, labeldistance=1.2)
plt.show()