Skip to content

Instantly share code, notes, and snippets.

@diginfo
Last active November 23, 2022 09:13
Show Gist options
  • Save diginfo/faac52654ee28992138c431da8383ba4 to your computer and use it in GitHub Desktop.
Save diginfo/faac52654ee28992138c431da8383ba4 to your computer and use it in GitHub Desktop.
Do a NS Lookup on all Allow from Anywhere entries in UFW
#!/bin/bash
## bash <(curl -Ls https://gist.github.com/diginfo/faac52654ee28992138c431da8383ba4/raw/)
##
IPS="$(ufw status | grep Anywhere.*ALLOW | awk '{print $3}')";
while IFS= read -r line; do
NS="$(dig +short +nocomments -x $line | tail -1)";
echo -e "$line\t\t: $NS";
done <<< "$IPS";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment