Skip to content

Instantly share code, notes, and snippets.

@sambauers
Last active April 6, 2017 07:18
Show Gist options
  • Save sambauers/76d9c1fc308b667ddc0a to your computer and use it in GitHub Desktop.
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.
# 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