GithubHelp home page GithubHelp logo

notwaldorf / cat-dns Goto Github PK

View Code? Open in Web Editor NEW
203.0 10.0 23.0 18 KB

:computer::cat: A DNS server that resolves everything to cats.

Home Page: http://meowni.ca/posts/go-cat-dns-go/

License: MIT License

JavaScript 100.00%

cat-dns's Introduction

cat-dns

The Internet needs more cats. DNS servers are the authority on all things Internet. Therefore, the best DNS server is the one that resolves everthing to cats. Guess what kind of DNS server this is (Hint: it's the cat kind).

Making it go

Before you do anything, you need to install node packages:

npm install

To run, start the server as a privileged process. This is because to be a DNS server, you need to be a UDP server on port 53. This is a small numbered port, which means it needs superpowers (however, these are dumped once started). This is how you run it:

sudo node cat-dns.js

By default, cat-dns will run attached to the localhost address. To bind this to a specific IP address on your host run:

sudo node cat-dns.js --address 192.168.1.10

Be careful running this on network addresses other than localhost. Other machines with access to the host you bind to can make DNS queries. For instance, binding to 0.0.0.0 and exposing your machine to the Internet will allow anyone with access to the Internet to make DNS queries to your machine.

To run on your local system, you need to somehow set your DNS server to be localhost. On a Mac, I do this by creating a new (Wi-Fi) interface (called Cats), in my Network preferences, and set its DNS server to 127.0.0.1. You could do this on your normal interface, but as a warning, while you're playing with this, pretty much nothing on your computer that requires the Internet works. Except for your browser. And then that's mostly cats. So being able to deactivate it easily is kind of key (I know. You might think 'Why would I ever want to deactivate cats?', but trust me on this one). I also recommend killing all the things that need to call the mothership (Google hangouts, Twitter feeds, Dropbox, iMessage), because they will not like your sassy cat answers, and will slow everything down.

You are ready

Go in your browser to www.google.com and wait a bit. You should see a cat. Go to a different website. Another cat. Congratulations. Your Internet is now all cats.

Wait what?

Do not panic. While I recommend you don't look at the source because it's gross, if you do look at the source, you'll notice all it does is resolve any hostname to 104.131.51.57 (or whatever cats.nanobit.org actually resolves to, as it keeps changing), which is a magical place on the Internet that has cats. You could also resolve everything to localhost, and serve your own cats on an HTTP server on port 80. But then you'd have to store your own cats locally, and that is animal cruelty. Thankfully, for now, while that magical static IP exists, you don't have to. That's it, that's all.

<3,

monica

cat-dns's People

Contributors

cpatulea avatar kennydude avatar notwaldorf avatar piperchester avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cat-dns's Issues

cat-dns answers are invalid

cat-dns's answers don't include the original question, in violation of RFC1035. DNS answers must include the original question being asked. So the qd_count should be 1, the an_count should be 1 (since cats have just one IP address) and ar_count and ns_count should always be zero.

Feature request: label compression for cat-dns

Per #5 cat-dns does not include the original question. One fix for this is to simply emit the question section and answer section in full, e.g.;

[12 byte header]
\3www\7example\3com\0\0\1\0\1
\3www\7example\3com\0\0\1\0\1\0\0\0\1\0\0\4\54\197\244\191

but DNS also supports label compression where labels can point to previous identical labels. See section 4.1.4. of RFC1035.

cat-dns qname parsing does not work with EDNS0 options

The cat-dns query name parser assumes that the query name is at the end of the DNS query, minus 4 bytes. This doesn't work if the query includes an EDNS0 option. See RFC2671, EDNS0 options show up as OPT records in the additional section of a query. To parse the query name, you need to start 12 bytes in to the message (after the header) and then add each label, so; www.example.com appears on the wire as;

\3www\7example\3com\0

so the full qname length in bytes is is 3 + 1 + 7 + 1 + 3 + 1 + 0 + 1 (the plus ones are for the byte encoding the label length) and iteration is needed.

Technically this math is valid only if the label length is a value <= 63 (otherwise it's a label-compressed pointer, and counts as one byte), but this can be ignored in the question section (which is never compressed).

just asking

Why cats ?
why not any other thing or animals ?

Is this because CATS have ESP ?

or any other reason ?

&& why intel-coders love CATS so much ?
I can't figure it out..

PS I don't hate cats, I love wild-cats

Thanks for helping me learn packet handling in Node

The issues I've opened have been filed in good humour, in case you're interested in figuring ways to handle them. I also have patches for them, but wasn't sure if that would be some kind of spoiler for the enjoyment of tinkering with low-level protocols.

cat-dns is not authoritative

cat-dns.js behaves like an authoritative name-server, but does not set the AA bit. Surely cat-dns is authoritative about cats in dns.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.