SnojNS = DNSHifter

It’s been a while since the last SnojNS update. Been working on a lot of other things lately, like a baby…and another one that’ll be here any day now.

SnojNS is now going to be called DNShifter thanks to my good buddy ivorycruncher. He wins Bacon Salt. I also may be rewriting it in Javascript using nodejs….maybe. So far things are going okay, but I’m running into issues with XML. Seems like nodejs doesn’t have built in support or an easy to install library* that’ll let me do the crazy stuff I was able to do in C#. So for the time being, the test code relies on some “fancy” handling of Javascript objects to provide a similar setup to an XML document.

It is definitely not pretty, but here’s a code dump..

Some of the reason for exploring nodejs is that it is very easy to have one codebase for multiple operating systems. Sure Mono can be used to run C# Linux, but it’s a really big package to install. There is also issues with some namespaces and classes not implemented 100% the same or even at all. I do suppose nodejs can have the same issues, but my biggest issue is with the ease one can account for the differences.

That and the code is currently sitting on a backup hard drive from when I installed Server 2008 on the laptop and I haven’t restored it yet.

Speaking of the C# version. Last I worked on it, I finally abstracted the code so listeners for IPv4 or IPv6 could be used. Work also began on using an ssh connection to do lookups using nslookup or dig. This feature I may kill in favor of what I’m currently dubbing DNSXML. Basically, using an httpd server with something like php to do the lookups and send back the results using xml for structure. Doing so would make the encryption (using https or ssh socks/port redirection) of the data easier and cross-platform. And by easier I mean, “I’m lazy and I don’t want to have to deal with that mess.”

*By install, I mean have the necessary library files in the same folder and a simple “require(‘xml_library’)”. In other words, no NPM and works on all OSes without installing things like cygwin.

SnojNS 0.2: Still has a lame name

After many an hour pouring over the code and running tests galore, I think I’ve resolved some of the major issues from version 0.1. Like how it would just randomly crash when the forward lookup hosts decided they had had enough. Now it’ll recover from it and chug along.

There is now some simple compression. So now instead of having 6 “” entires, we now have 1 with references to that first occurrence. Down the road, I plan on adding better compression so that parts of domains can be compressed. For instance “” becomes “someSubdomain.{reference to first}”.

Commit comments:

fixed: non-coded types returned empty from outside sources.
fixed: crash when socket was interupted.
added: m attribute to tags. <a m="somehost" ip="" />
added: beginning dns compression...I think. at least it appears to work.
notes: improved xml lookups. now can easily add xpath based lookups.
notes+: might need to improve this further to allow other filter types.
notes: rm attributes will likely wait until xpath fn:matches function is available.


I’ve noticed while using HE’s IPv6 Tunnel Broker service, that I can’t surf IPv6 sites while using snojns. Not sure why this is, but I wonder if there needs to be an IPv6 socket listener as well.


If you’re smart enough to run this, you’ll know which you’ll want to get.

snojns 0.2.0: Release, Debug, Source.

Its a mnemonic kind of thing, a dns kind of thing

Hosts files are great, you can specify any host to IP combination, overriding anything.

But what about other types of records? Hosts files can’t do service, text, pointer records, etc? So what to do if you want to test these record types? You could setup your own DNS server, create a new zone, add the records to test, while mail, chat, and other services fail left and right on your machine. Or you could use SnojNS.

SnojNS sits between you and your current DNS server. It can add or change domains much like the hosts file, but it can do so much more, like CNAME, PTR, or SRV record types. I’m hoping to add more at later dates, but not to worry, when it comes across a request it doesn’t understand, it just forwards it and relays the info back so you’re never without internet access.

Running it:

Unzip it or compile, edit the hosts.config, open a command prompt, and run. Or if you’re feeling brave, double click to run it and forget about logging any errors that pop up.

sample output of snojns.


Seems to have an issue when there is a lot of requests. That is…it’ll crash. Though the data suggests that it has to do with the forward lookup rejecting udp connections and we can’t yet recover from the error.


If you’re smart enough to run this, you’ll know which you’ll want to get.

snojns 0.1.0: ReleaseDebugSource


  • define a, cname, ptr, and srv resource records
  • forward lookups for undefined domains and unknown resource record types
  • define forward lookups based on requested domain
    • can use google’s servers ( while uses opendns’ (
  • a lot of unused code and commented out sections.

Features Road map:

Not all may happen, but ideas I’d like to explore.

  • config file watch: try reloading the hosts file after a save operation so there’s no need to restart.
  • more record types: like AAAA (ipv6), TXT, and MX.
  • separate dns packet parsing into its own dll
  • create an actual windows service?
  • cache! need that cache.
  • ttl definitions for local records?
  • plugin system to introduce new record types and classes (though who would use anything other than IN?)
  • TCP
  • lookups over ssh: ‘cuz we can’t trust the transit (I’m looking at you Hak5, with your pineapple).
  • load balancing round robins for both answers and forward lookups.



Also, if someone comes up with a better name than “SnojNS” that I like, I’ll buy you $10-15 something from or amazon as thanks….so thanks! Just post it in the comments or something, as long as I get your email and address.