tags:

views:

29

answers:

2

I'm working on an application that connects to URLs, and it responds differently depending on whether or not an address resolves in DNS. I need to find a way to simulate DNS Hijacking so that I can test that my application handles it correctly.

Anybody know a way to do that?

+3  A: 

Set up a DNS Server on a second pc and use this as your referenced DNS. Then you can shutdown it for sometime or modify the answers to try your handling behavior. If you dont have a second machine you can also set it up in a virtual machine.

JanW
Thanks, this is what I did. I still want to dive in and figure out how to make a wildcard DNS entry that leads the user to a page that depends on what they entered (i.e. how ISPs do it, where it leads to their search engine with the URL as a query). But that's a separate problem (purely a "How do I do this on this server?" problem).
Marcus
Actually I do not know how to do this. Maybe you need some kind of open dns service, in which you can specify a handler for unresolved URLs. I never tried this before on Windows Server environment.
JanW
+1  A: 

Just add the "hijacked" hosts into your hosts file. In Linux, this should be in /etc/hosts; in Windows, %SYSTEMDIR%\drivers\etc\hosts..

The entries are in the format ip.addr.ess.here hostname1 hostname2 (there should already be entries for localhost, so add others to match your taste)

When you're done, remove (or comment out) from the hosts file again.

Piskvor