Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- ########################################################################
- #
- # surbl
- # $Id: surbl,v 1.2 2016/08/12 14:06:13 elias Exp $
- #
- # Send queries to SURBL.
- #
- # Requires dig and gawk. (Does the good old awk perform bitwise ops?)
- #
- ########################################################################
- for domain
- do
- result=`dig ${domain}.multi.surbl.org |
- sed -e '/^;/d' -e '/^\s*$/d' -e '/SOA/d' -e 's/.*\.\(.*$\)/\1/'`
- echo $domain $result
- done |
- gawk '
- { if(!$2) $2 = 0
- printf("%s\t", $1)
- if ($2) { printf("\033[1;31mLISTED:\033[0m ") }
- if (and($2, 8)) { printf("PH ") }
- if (and($2, 16)) { printf("MW ") }
- if (and($2, 64)) { printf("ABUSE ") }
- if (and($2, 128)) { printf("CR ") }
- if (!$2) { printf("\033[1;32mokay\033[0m") }
- printf("\n")
- }'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement