Skip to content

Instantly share code, notes, and snippets.

@techouse
Last active November 8, 2016 10:19
Show Gist options
  • Select an option

  • Save techouse/1edbc54005238e334e76e909e2f48ff4 to your computer and use it in GitHub Desktop.

Select an option

Save techouse/1edbc54005238e334e76e909e2f48ff4 to your computer and use it in GitHub Desktop.

Revisions

  1. techouse revised this gist Nov 8, 2016. 1 changed file with 7 additions and 7 deletions.
    14 changes: 7 additions & 7 deletions psky.sh
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,11 @@
    #!/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;
    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)
    @@ -15,4 +15,4 @@ elif [ "$STATUS" == "127.0.0.2" ] || [ "$STATUS" == "127.0.0.3" ] ; then
    echo "SPAM";
    else
    echo "UNKNOWN";
    fi
    fi
  2. techouse revised this gist Nov 8, 2016. No changes.
  3. techouse revised this gist Nov 8, 2016. No changes.
  4. techouse revised this gist Nov 8, 2016. No changes.
  5. techouse created this gist Nov 8, 2016.
    18 changes: 18 additions & 0 deletions psky.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    #!/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