Last active
April 6, 2017 07:18
-
-
Save sambauers/76d9c1fc308b667ddc0a to your computer and use it in GitHub Desktop.
Does a reverse lookup on a domain name's IP address and adds emoji, because emoji.
This file contains 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-emoji-digr.sh` | |
digr() { | |
# These will show up in an emoji compatible terminal | |
DIGR_EMOJI=(π π π π π π π π π π π π π π₯ π₯ π ); | |
for arg; do | |
RANDOM_DIGR_EMOJI=${DIGR_EMOJI[$((RANDOM%14))]}; | |
echo "${RANDOM_DIGR_EMOJI##*/} $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; | |
# Below will paste an ssh command incorporating the result into the copy buffer on Mac OS X | |
# printf "ssh deploy@%s" $DIGR_PTR | sed 's/\.*$//' | tr -d '\n' | pbcopy; | |
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