Advertisement
goebelmasse

SURBL-Abfrage für Domains

Aug 12th, 2016
436
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.84 KB | None | 0 0
  1. #!/bin/sh
  2. ########################################################################
  3. #
  4. # surbl
  5. # $Id: surbl,v 1.2 2016/08/12 14:06:13 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. for domain
  14. do
  15.     result=`dig ${domain}.multi.surbl.org |
  16.     sed -e '/^;/d' -e '/^\s*$/d' -e '/SOA/d' -e 's/.*\.\(.*$\)/\1/'`
  17.     echo $domain $result
  18. done |
  19. gawk '
  20.  { if(!$2) $2 = 0
  21.    printf("%s\t", $1)
  22.    if ($2)           { printf("\033[1;31mLISTED:\033[0m ") }
  23.    if (and($2, 8))   { printf("PH ") }
  24.    if (and($2, 16))  { printf("MW ") }
  25.    if (and($2, 64))  { printf("ABUSE ") }
  26.    if (and($2, 128)) { printf("CR ") }
  27.    if (!$2)          { printf("\033[1;32mokay\033[0m") }
  28.    printf("\n")
  29.  }'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement