2
I have a network dump (PCAP file) containing attacks slowloris. The following script will show the number of connections to IP 192.168.1.2 on port 80:
/usr/sbin/tcpdump -anr myfile.pcap |
sed 's/^.*IP \([^:]*\)192.168.1.2.80:.*/\1/p;d' |
sort |
uniq -c
that shows:
10 192.168.1.8.36684 >
4 192.168.1.8.39619 >
9 192.168.1.8.39856 >
4 192.168.1.8.39896 >
5 192.168.1.8.40195 >
12 192.168.1.8.40196 >
9 192.168.1.8.52288 >
7 192.168.1.8.58529 >
9 192.168.1.8.58639 >
9 192.168.1.8.58730 >
6 192.168.1.8.58835 >
13 192.168.1.8.58851 >
12 192.168.1.8.58852 >
10 192.168.1.8.58882 >
myfile.PCAP é um time slice de 3 minutos!
My question is: I would like to sum up the connections and show only the total, ie take the output of the previous script and add up:
10 +4 + 9 +... +12+10.
How to do this in Python? I don’t know how to separate the initial number from the IP:Port.
:but I need to read the file first. Suppose the file containing the displayed output is output.txt. How would it look like?
– Ed S
See my issue, if it’s clearer.
– Leonel Sanches da Silva
could help in https://answall.com/questions/207138/gr%C3%a1fico-do-total-conex%C3%b5es-per-second-during-one-attack-nega%C3%A7%C3%a3o-de-servi%C3%a7o
– Ed S
I think I have time today. I’ve had a try here.
– Leonel Sanches da Silva
I really appreciate it. I got caught up in that problem!
– Ed S