Использование collections.defaultdict
Пример:
from collections import defaultdict
test=[["2019-01-05 03:15:49","192.168.0.15","192.168.0.116:4070","network discover"],
["2019-01-05 03:25:49","192.168.0.15","192.168.0.1:4070","network discover"],
["2019-01-05 03:35:49","192.168.0.15","192.168.0.116:4070","network discover"],
["2019-01-05 03:55:49","192.168.0.12","192.168.0.1:4070","network discover"],
["2019-01-05 04:38:13","192.168.0.15","192.168.0.41:445","ETERNALBLUE tool"],
["2019-01-05 05:28:13","192.168.0.12","192.168.0.39:445","ETERNALBLUE tool"]]
result = defaultdict(int)
for i in test:
result[(i[-1], i[1])] += 1
print(result)
Выход:
defaultdict(<type 'int'>, {
('network discover', '192.168.0.12'): 1,
('ETERNALBLUE tool', '192.168.0.15'): 1,
('ETERNALBLUE tool', '192.168.0.12'): 1,
('network discover', '192.168.0.15'): 3
})