Last active
July 12, 2016 04:34
-
-
Save sambauers/df8948e22ad6f6d187d8 to your computer and use it in GitHub Desktop.
Does a reverse lookup on a domain name's IP address.
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
# Add this file to your home directory then include it in ~/.profile using `. ~/.profile-digr.sh` | |
digr() { | |
for arg; do | |
echo -e "\033[38;5;244m*\033[0m $arg"; | |
for DIGR_IP in $(dig +short $arg); do | |
echo -e " \033[38;5;244m↳ \033[0m" $DIGR_IP; | |
done; | |
if [[ "$DIGR_IP" != "" ]]; then | |
for DIGR_PTR in $(dig +short -x $DIGR_IP); do | |
echo -e " \033[38;5;244m↵ \033[0m" $DIGR_PTR; | |
done; | |
if [[ "$DIGR_PTR" == "" ]]; then | |
echo -e " \033[38;5;244m↵ \033[0m \033[31mPTR NOT FOUND\033[0m"; | |
fi; | |
unset DIGR_PTR; | |
else | |
echo -e " \033[31m(╯°□°)╯︵ ┻━┻ NOT FOUND\033[0m"; | |
fi; | |
unset DIGR_IP; | |
done; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment