I am doing an assignment, I'm asked to answer certain questions based on pcap file that I'm given. One of the question is to find the top 5 (according to number of packets sent) source IP addresses.
I have come up with the below command:
$ tshark -r assign1.pcap | sort -n -7 | tail -n 5 | awk '{print $3}'
where
tshark -r
reads the pcap fileassign.pcap
is the packet capture filesort -n -7
sorts the file based on column 7 (this column has length of package for each ip address)tail -n 5
print the last 5 records that has the highest length for packetawk '{print $3}
prints only the third column.
Now here is my problem since I need unique top 5 source ip addresses, so I tried to pipe uniq
command in the end of script but doesn't help. I also tried to use sort -u -t, -k3,3
from this link but this also doesn't print unique ip addresses!
My pcap file column header look like this: