Created
March 28, 2022 05:14
-
-
Save Gowee/a0f2d470aa5fa9b9c0fee15ca3b23f78 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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