Skip to content

Instantly share code, notes, and snippets.

@Gowee
Created Mar 28, 2022
Embed
What would you like to do?
#!/usr/bin/env python3
# filter disinct connections by 4-tuples from tcpdump output
pairs = set()
while (line := input()):
time, family, orig, _, dest, remaining = line.split(maxsplit=5)
dest = dest[:-1]
if (orig, dest) not in pairs:
print(f"{orig} > {dest}, {time}, {remaining}")
pairs.add((orig, dest))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment