Created
March 4, 2020 17:27
-
-
Save conclusionlogic/f18422936b36fd6840f53ee2eb9695a6 to your computer and use it in GitHub Desktop.
[unique IPs accessing HTTPS port] check which IPs are connecting to HTTPS port on a node #bash #shell #tcpdump #awk
This file contains hidden or 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 bash | |
$ tcpdump -i eth0 -nn ip dst host $(hostname --ip-address) and tcp dst port 443 and src net not 10.0.0.0/16 | awk '{ ts = gensub(/([0-9]+:[0-9]+:[0-9]+.[0-9]+)(.*)/,"\\1","g",$1); ip = gensub(/([0-9]+.[0-9]+.[0-9]+.[0-9]+)(.*)/,"\\1","g",$3); if(!d[ip]) { print ts" "ip; d[ip]=1; fflush(stdout) } }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment