goebelmasse

SURBL-Abfrage für Domains (verbesserte Version)

Aug 21st, 2016
646
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2. ########################################################################
  3. #
  4. # surbl
  5. # $Id: surbl,v 1.3 2016/08/17 23:16:51 elias Exp $
  6. #
  7. # Send queries to SURBL.
  8. #
  9. # Requires dig and gawk. (Does the good old awk perform bitwise ops?)
  10. #
  11. ########################################################################
  12.  
  13. if test -t 1
  14. then
  15.     term=1
  16. else
  17.     term=0
  18. fi
  19.  
  20. for domain
  21. do
  22.     result=`dig ${domain}.multi.surbl.org |
  23.     sed -e '/^;/d' -e '/^\s*$/d' -e '/SOA/d' -e 's/.*\.\(.*$\)/\1/'`
  24.     echo $domain $result
  25. done |
  26. gawk '
  27. BEGIN {
  28.  term = '$term'
  29.  if (term) {
  30.    red="\033[1;31m"
  31.    green="\033[1;32m"
  32.    norm="\033[0m"
  33.  } else {
  34.    red=""
  35.    green=""
  36.    norm=""
  37.  }
  38. }
  39. {
  40.  if(!$2) $2 = 0
  41.  printf("%s\t", $1)
  42.  if ($2)           { printf("%sLISTED:%s ", red, norm) }
  43.  if (and($2, 8))   { printf("PH ") }
  44.  if (and($2, 16))  { printf("MW ") }
  45.  if (and($2, 64))  { printf("ABUSE ") }
  46.  if (and($2, 128)) { printf("CR ") }
  47.  if (!$2)          { printf("%sokay%s", green, norm) }
  48.  printf("\n")
  49. }'
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×