Blame | Last modification | View Log | Download | RSS feed
#! /usr/bin/perl -w
use BIND::Config::Parser; # apt-get install libbind-config-parser-perl
my $CONFIG_DIR = '/etc/bind/';
my $ZONE_CONFIG = $CONFIG_DIR . 'named.conf.local.shared';
my $TESTING = 0;
my @ignore = ( '192-27.0.124.74', '74.197.65' );
my $ignoreRegex = '^(' . join( ')|(', @ignore ) . ')';
my $parser = new BIND::Config::Parser;
my $indent = 0;
$parser->set_open_block_handler( sub {
if ( $_[0] eq 'zone' ) {
$zone = $_[1];
$zone =~ s/"//gi;
print "$zone\n" if ( $zone !~ m/$ignoreRegex/ );
}
} );
if ( $TESTING ) {
# Set up callback handlers
$parser->set_open_block_handler( sub {
print "\t" x $indent, join( " ", @_ ), " {\n";
$indent++;
} );
$parser->set_close_block_handler( sub {
$indent--;
print "\t" x $indent, "};\n";
} );
$parser->set_statement_handler( sub {
print "\t" x $indent, join( " ", @_ ), ";\n";
} );
}
# Parse the file
$parser->parse_file( "$ZONE_CONFIG" );
1;
Generated by GNU Enscript 1.6.5.90.