Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Matts (1087)

  (email not shown publicly)

I work for MessageLabs [] in Toronto, ON, Canada. I write spam filters, MTA software, high performance network software, string matching algorithms, and other cool stuff mostly in Perl and C.

Journal of Matts (1087)

Friday April 12, 2002
06:14 AM

DNS Server

[ #4139 ]

The challenge was to write a DNS server in a couple of lines of Perl. The spec was that it needed to return the same IP address for all requests, so that we could use it to see if viruses were trying to connect to the internet. Simpler solutions might have been to install ZoneAlarm on the machine to test for things like that, but a virus might detect that...

Anyway, the new version of Net::DNS (0.19) allowed me to do it in 3 lines (damnit!):

Net::DNS::Nameserver->new( ReplyHandler => sub { return ("NOERROR",
[Net::DNS::RR->new("$_[0] 3600 $_[1] A")],[],[])if$_[2]eq"A";
return ("NXDOMAIN", [], [], []) })->main_loop; use Net::DNS 0.19;

Still, very cool.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.