Missing headers:
Code:
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
Apart from that - compiles without as much as a warning in a modern environment (Mac OS) - nice. Static zone file or logic in the authoritative servers?
Unnecessary headers are for wusses.
It was something I wrote in like 10 minutes while having an insipid argument about the "value of firewalls" with someone on NANOG, IIRC. I needed to hammer home that you didn't need direct IP connectivity to be able to communicate, or even to transfer significant amounts of stuff.
The encoder to put data into the zone was equally pithy code, and hanging it on the output of "banner -w80" resulted in data like:
Code:
0.dldns IN A 0.0.124.119
1.dldns IN A 32.32.32.32
2.dldns IN A 32.32.32.32
3.dldns IN A 32.32.32.32
4.dldns IN A 32.32.32.32
5.dldns IN A 32.32.32.32
6.dldns IN A 32.32.32.32
7.dldns IN A 32.32.32.32
8.dldns IN A 32.32.32.32
9.dldns IN A 32.32.32.32
10.dldns IN A 32.32.32.35
11.dldns IN A 35.35.35.35
12.dldns IN A 35.35.35.35
13.dldns IN A 35.35.35.35
14.dldns IN A 35.35.10.32
...etc...
I was basically trolling someone who didn't understand sidechannels and other forms of nontraditional data exfiltration (or infiltration in this case). As you know, DNS is effectively just a database, and even if you think you are carefully controlling the types of RR responses, are you going to block IN A's? I can get four bytes per database query. And with the IPv4 Internet being the tragically full thing it is, there aren't even significant bogon spaces that could be used as alarm triggers to detect this. Only query rate would easily give it away.
For everyone else who didn't care to compile this, it just prints out an ASCII printer banner that says something like "Downloaded!" on the TTY when run against DNS servers that can resolve queries on the public Internet. The implication is that it COULD be used as a technique to download nefarious code to your firewall-protected hosts by (essentially) proxying through a DNS recurser, which are often kept available to firewall-restricted hosts for many reasons.
The interconnected nature of all of our networks makes it very difficult to correctly control these sorts of sidechannels. Even being able to signal a single bit could be significant in some cases,
consider Paul Revere!
This is all very relevant to finding ways to signal certain things out to the network when there is "no active Internet connection", the topic of this thread. In the case of this thread, however, there is absolutely an active Internet connection, it's just been deliberately misconfigured to make it harder for the NAS host to reach the Internet. In order to solve the OP's problem, we really need to understand the context, the goal, and the realistic threat models that are being protected against.
If you want to say I take this stuff too seriously, or am crazy, or am a cranky old fart, I will happily plead guilty on all counts.