Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save conclusionlogic/f18422936b36fd6840f53ee2eb9695a6 to your computer and use it in GitHub Desktop.
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
#!/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