-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdnsbl-check-standalone.sh
executable file
·92 lines (84 loc) · 1.26 KB
/
dnsbl-check-standalone.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/sh
#
# dnsbl-check-standalone.sh
#
# By Damon Tajeddini (dta)
# # 10.03.2009
#
DNSBLlist=`grep -v ^# <<!
rfc-ignorant.org
cbl.abuseat.org
virbl.dnsbl.bit.nl
blackholes.five-ten-sg.com
dnsbl.inps.de
ix.dnsbl.manitu.net
no-more-funn.moensted.dk
combined.njabl.org
dnsbl.njabl.org
dnsbl.sorbs.net
bl.spamcannibal.org
bl.spamcop.net
sbl.spamhaus.org
xbl.spamhaus.org
pbl.spamhaus.org
dnsbl-1.uceprotect.net
# dnsbl-2.uceprotect.net
# dnsbl-3.uceprotect.net
!`
# reverse IP address bytes
convertIP()
{
set `IFS=".";echo $1`
echo $4.$3.$2.$1
}
usage()
{
echo "Usage: $0 [-H <host>|-p]"
echo " -H IP address to check"
echo " -p Print list of DNSBLs"
exit 3
}
# Checks the IP with list of DNSBL servers
check()
{
for i in $DNSBLlist
do
if dig $ip_arpa.$i +short | grep -q "^127.0.0."
then
echo "** Service Alert: $ip found on $i **"
echo <<!
*** DNSBL WARNING ***
Service: $progname
Host: `hostname`
Date/Time: `date`
Additional Info: DNSBL-Alarm: $ip is listed on $i
!
fi
done
exit
} # check
case $1 in
-H)
if [ -z "$2" ]; then
echo "ip address missing"
exit
fi
ip=$2
ip_arpa=`convertIP $ip`
check;;
-p)
for i in $DNSBLlist
do
echo $i
done
exit;;
--help)
usage
exit;;
*)
if [ -z "$1" ]; then
usage
fi
echo "unknown command: $1"
exit;;
esac