Following on from performing basic DNS Lookups in Python, it’s relatively trivial to begin testing DNS Block Lists/Real Time Black Lists for blocked mail server IP addresses. To assist in preventing spam, a number of public and private RBLs are available. These track the IP addresses of mail servers that are known to produce spam, thus allowing recipient mail servers to deny delivery from known spammers.
RBLs operate over DNS. In order to test a RBL, a DNS query is made. As an example, zen.spamhaus.org is a popular RBL. If I wanted to test IP address 126.96.36.199 against the zen.spamhaus.org blocklist, I would reverse the octets in the IP address and then append ‘.zen.spamhaus.org’, i.e. 188.8.131.52.zen.spamhaus.org. I then perform an ‘A’ record lookup on said host:
root@w:~/tmp# host -t a 184.108.40.206.zen.spamhaus.org Host 220.127.116.11.zen.spamhaus.org not found: 3(NXDOMAIN)
Excellent. IP 18.104.22.168 was not found in zen.spamhaus.org. NXDOMAIN is returned.
Now, to take a known spammer’s IP: 22.214.171.124:
Read the rest of this entry »