From: J. M. M. I. <ma...@mo...> - 2003-05-22 20:03:30
|
Hi, I'm trying to work on some spam filtering software that uses dnsjava to do reverse DNS lookups using specific DNS servers. Specifically, i'm using DNS Realtime Blackhole Lists (DNSRBL's). Basically, the idea is that given a server, "permblock.easynet.net" -- and an ip address you want to check against that server's "known spammers list" (in this case, 69.1.80.67-- you do a lookup of "67.80.1.69.permblock.easynet.net." Some DNS servers this works with, others it doesnt. basically, any dns server i can't ping doesnt work. I get an "UnknownHostException" thrown when i create a resolver. Anyway, I'm wondering if there's a way around this that i'm not understanding, or if there's some limitation there, or if maybe i'm totally off base here. Thanks for any help in advance, Matt Miller Code is as follows: ---------------------------- /* * TestDNS.java * * Created on May 22, 2003, 2:03 PM */ import org.xbill.DNS.*; import java.net.*; import java.io.*; /** * * @author matt */ public class TestDNS { /** Creates a new instance of TestDNS */ public TestDNS() { } public static void main(String args[]) { try { String[] dnslist = new String[1]; dnslist[0] = "permblock.easynet.net"; Resolver resolver = null; try { resolver = new ExtendedResolver(dnslist); } catch (UnknownHostException ee) { ee.printStackTrace(); } Name name = null; try { name = Name.fromString("67.80.1.69.permblock.easynet.net."); } catch (Exception e) { e.printStackTrace(); } Record question = Record.newRecord(name, Type.A, DClass.IN); Message query = Message.newQuery(question); Message response = null; try { response = resolver.send(query); } catch (IOException e) { // A network error occurred. Press on. e.printStackTrace(); System.exit(0); } short rcode = response.getHeader().getRcode(); System.out.println("RCODE = " + rcode); } catch (Exception e) { e.printStackTrace(); } } } |