# Listing 1:

$SOA 3600 hostmaster.nixspam.xx. nixspam.xx. 0 1h 10m 5d 1200
$NS 86400 localhost.
# Daten im BIND-aehnlichen Format
schpamkischte.de.  A 127.0.0.4
schpamkischte.de.  TXT "Admin kooperiert nicht"


# Listing 2:

$1 You shouldn't be here!
$2 http://www/q.cgi
:127.0.0.4:Adresse bei uns blockiert. Siehe $2?$
#
127.0.0.2       ; Test
10/8            ; Ganzes CIDR 10/8
192.168 :127.0.0.3:$1; RFC 1918
62.251.99.129
1.2.3.4 :8:Go away!


# Listing 3:

rbldnsd \
 -u nobody \
 -4 \
 -r /var/dnsbl \
 -t 1200 \
 -c 60 \
 -l +querylog \
 -b 127.0.0.30/53 \
 nixspam.xx:generic:domains.txt \
 nixspam.xx:ip4set:ips.txt \
 nixspam.xx:ip4set:ix-blacklists.txt


# Listing 4:

$ dig @127.0.0.30 schpamkischte.de.nixspam.xx any
schpamkischte.de.nixspam.xx. 1200 A   127.0.0.4
schpamkischte.de.nixspam.xx. 1200 TXT "Admin kooperiert nicht"

$ dig @127.0.0.30 4.99.168.192.nixspam.xx txt
4.99.168.192.nixspam.xx.     1200 TXT "You shouldn't be here!; RFC 1918"

$ dig @127.0.0.30 129.99.251.62.nixspam.xx txt
129.99.251.62.nixspam.xx.    1200 TXT "Adresse bei uns blockiert. Siehe http://www/q.cgi?62.251.99.129"


# Listing 5:

#!/usr/bin/perl
# nixgrab: by Jan-Piet Mens
# Get the NiXSpam IP-Blacklist and convert to ip4set
# for rbldnsd

use LWP::UserAgent;

my $u =
'http://www.heise.de/ix/nixspam/nixspam.blackmatches';

$ua = LWP::UserAgent->new;
$ua->agent("nixgrab/1.0 ");

my $req = HTTP::Request->new(GET => $u);
my $res = $ua->request($req);

if ($res->is_success) {
   print "# Created by $0 from $u\n";
   print "\$1 NiXSpam\n";
   print ":127.0.0.4:Blocked by \$1\n";
   print "#\n";

   proc(split("\n", $res->content));
} else {
   print STDERR $res->headers_as_string();
   die "Can't retrieve URL $u: $!\n";
}

sub proc {
   my (@lines) = @_;
   my ($ip, $from, $date);

   foreach $_ (@lines) {
      next if (/^#/ || /^$/);    # Comments

      if (/^(.*:\d+) (\d+\.\d+\.\d+.\d+)\s+(.*)$/) {
         $date = $1;
         $ip = $2;
         $from = $3;

         printf "%-16s ; %s, %s\n",
              $ip, $date, $from;
      }
   }
}


# Listing 6:

options {
  directory "/var/named";

  listen-on { 127.0.0.1; 12.34.56.78; };
  listen-on-v6 { none; };
  allow-query { any; };
};

zone "nixspam.xx" IN {
  type forward;
  forward only;
  forwarders {
   127.0.0.30 port 53;  // rbldnsd
  };
};
