Skip to content

Instantly share code, notes, and snippets.

@techouse
Last active November 8, 2016 10:19
Show Gist options
  • Save techouse/1edbc54005238e334e76e909e2f48ff4 to your computer and use it in GitHub Desktop.
Save techouse/1edbc54005238e334e76e909e2f48ff4 to your computer and use it in GitHub Desktop.
Protected SKY IP checker. Check if the given IP is blacklisted via http://psky.me/
#!/bin/sh
if [[ -z $1 ]] ; then
echo "psky.sh <IP>"
echo ""
echo "Protected SKY IP checker"
echo "Check if the given IP is blacklisted"
echo ""
return 1;
fi
REVERSE=$(echo $1 | awk -F '.' '{ print $4 "." $3 "." $2 "." $1 }')
STATUS=$(dig $REVERSE.bad.psky.me +short $1)
if [ "$STATUS" == "NOERROR" ] ; then
echo "OK";
elif [ "$STATUS" == "127.0.0.2" ] || [ "$STATUS" == "127.0.0.3" ] ; then
echo "SPAM";
else
echo "UNKNOWN";
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment