Skip to content

Instantly share code, notes, and snippets.

@Gowee
Created March 28, 2022 05:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gowee/a0f2d470aa5fa9b9c0fee15ca3b23f78 to your computer and use it in GitHub Desktop.
Save Gowee/a0f2d470aa5fa9b9c0fee15ca3b23f78 to your computer and use it in GitHub Desktop.
#!/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