Skip to content

Instantly share code, notes, and snippets.

@YSaxon
Created September 1, 2023 18:44
Show Gist options
  • Save YSaxon/73c54057aa3f7fe128b88bf4efe680f2 to your computer and use it in GitHub Desktop.
Save YSaxon/73c54057aa3f7fe128b88bf4efe680f2 to your computer and use it in GitHub Desktop.
get hostnames currently communicating with
netstat -an | awk '{if ($5 ~ /[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/) print $5}' | cut -d. -f1-4 | sort -u | while read -r line; do host $line; done | grep pointer | awk '{print $NF}' | sort -u
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment