By using tcpdump output data I want to create a script that it summarizes source-destination IP, start-stop time, how many packets found, what sum of packet length
Currently, to accomplish this I created a multi-dimensional list which have the data like following and extracted from tcpdump
[['10.247.15.39', '172.217.2.161', '13:25:31', '46'], ['10.247.15.39', '172.217.2.163', '13:25:31', '46'], ['172.217.2.161', '10.247.15.39', '13:25:31', '0'],...
There are over 3000 entry
Now I need the find other entries which have same source and destination IP then when match found let's say 10 matches found it will for that specific pair
I want it to summarize like this
Desired Output:
Source: 151.101.125.140 dest: 10.247.15.39 start:13:25:31
stop:13:25:35 package amount:10 total length: 1965482
Start and stop time determined based on find and last package found time
And I want it to keep repeat same process for every pair of source and destination IP so basically it will create a summary list for me to take look at it and view if there is too much traffic happened between two IP
But I don't have any idea how I can pair two indexes and search for matches in the list.
I thought doing something like
filtered_list = []
i = 0
i_2 = 1
try:
while i <= len(parse_output):
if parse_output[i][0] == parse_output[i_2][0]:
print("source ip same")
if parse_output[i][1] == parse_output[i_2][1]:
print("destination same")
i = i + 1
i_2 = i + 1
except IndexError:
But just my brain stopped if you can help me I would be glad