| |
PA2AGA > TCPDIG 19.01.97 04:40l 194 Lines 6006 Bytes #-10752 (0) @ EU
BID : TCP_97_5B
Read: DG7DAH GUEST
Subj: TCP-Group Digest 97/5B
Path: DB0AAB<DB0KCP<DB0ZKA<DB0LX<DB0AAA<DB0CZ<DB0FRB<DB0GE<LX0PAC<ON5VL<
ON4AIC<ON1AEO<ON6AR<PI8HWB<PI8ZAA<PI8GCB<PI8WFL<PI8VNW
Sent: 970118/1801Z @:PI8VNW.#ZH2.NLD.EU #:20400 [Hoek v Holland] FBB5.15c
From: PA2AGA@PI8VNW.#ZH2.NLD.EU
To : TCPDIG@EU
Received: from pa2aga by pi1hvh with SMTP
id AA26467 ; Sat, 18 Jan 97 17:44:04 UTC
Received: from pa2aga by pa2aga (NET/Mac 2.3.62/7.1) with SMTP
id AA00000824 ; Fri, 17 Jan 97 00:24:03 MET
Received: from pa2aga-1 by pa2aga with SMTP
id AA00000750 ; Fri, 17 Jan 97 00:11:45 MET
Received: from pa2aga-1 by pa2aga-1 (NET/Mac 2.3.62/7.5.5) with SMTP
id AA00009048 ; Fri, 17 Jan 97 00:11:43 MET
Date: Thu, 16 Jan 97 20:32:15 MET
Message-Id: <tcp_97_5B>
From: pa2aga
To: tcp_broadcast@pa2aga-1
Subject: TCP-Group Digest 97/5B
X-BBS-Msg-Type: B
# to maintain update versions of this file.
my @field = (); # temporary fields created during run
my %hostname = (); # hostname hash lookup
my %cname = (); # cname hash lookup
my %ns = (); # nameserver hash lookup
my $ampr_file = "ampr.org"; # file used to get the normal lookups
my $pass = 1; # pass through the file, looking for stuff
my $hostcount = 0; # number of hosts in our ip address range
my $changes; # number of changes in passes 2..n
my $run_time = `date +\"%Y%m%d.%H%M%S\"`;
my $serial = ""; # used to capture serial of ampr.org
my $soa = ""; # used to capture SOA info of ampr.org
my $ip_prefix = "44.133"; # ip address prefix to search
my $ip_search = "44\.133";
my $domain = "ea";
my $domain_suffix = "ampr.org"; # domain suffix to search
my $domain_search = "ampr\.org";
my $outfile = $domain . "." . $ampr_file . "-" . $run_time;
open(INFILE, $ampr_file ) || die "Cannot open file $ampr_file";
open(OUTFILE, ">$outfile" ) || die "Cannot create output file";
print "; \n";
print "; extract of $ip_prefix.x.x at $run_time"; # should fix $run_time
# to have trailing nl
print "; pass $pass: extracting IN A entries from $ampr_file.\n";
print "; (not showing normal matching entries)\n";
print ";\n";
#
# first pass of file : look for <hostname> IN A $ip_prefix.x.x
# and add <hostname> to %hostname
#
while ( <INFILE> ) {
chomp; # remove trailing newline
if ( /[a-z0-9._-]+\tIN\tA\t$ip_search\.[0-9]{1,3}\.[0-9]{1,3}/i ) {
@field = split("\t", $_ );
# hostnames should normally be defined locally to the domain
# ampr.org, so check this is so and warn if it is not.
#
# check for fully qualified domain name (shouldn't have?)
$strange = 0;
if ( &is_fqdn( $field[0] ) ) {
$strange = 1;
if ( &is_inthisdomain( $field[0], $domain_search) ) {
print "; WARNING '$field[0]' is fully qualified, should be
local\n";
print OUTFILE "; WARNING '$field[0]' is fully qualified, should be
local\n";
}
else {
print "; WARNING '$field[0]' is in another domain\n";
print OUTFILE "; WARNING '$field[0]' is in another domain\n";
}
}
if ( $strange ) {
print "$field[0]\tIN\tA\t$field[3]\n";
}
print OUTFILE "$field[0]\tIN\tA\t$field[3]\n";
$hostcount++; # update the number of entries found
$hostname{ $field[0] } = 1; # add hostname to hash
}
if ( /IN\ +\SOA/ ) {
$soa = $_;
}
if ( /; Serial/ ) {
$serial = $_;
}
if ( !( $soa eq "" ) && !( $serial eq "" ) ) {
print OUTFILE "; based on SOA record:\n";
print OUTFILE "; $soa\n";
print OUTFILE "; $serial\n";
print "; based on SOA record:\n";
print "; $soa\n";
print "; $serial\n";
$soa = "";
$serial = "";
}
}
print "; --- end of pass $pass [found $hostcount host(s)] ---\n";
print OUTFILE "; --- found $hostcount host(s) ---\n";
#
# start again, now looking for hostnames within MX, NS and CNAME lines
# note: this has to be repeated until no new entries are found
#
do {
$changes = 0;
$pass++;
open(INFILE, "ampr.org") || die "Cannot open the ampr.org file";
while ( <INFILE> ) {
chomp; # remove trailing newline
############################
# CNAME DECLARATIONS GO HERE
############################
# CNAME declarations are of the form:
# host IN CNAME host2
#
# both host and host2 may be fully qualified domain names, though
# host, being in our domain, shouldn't need to be.
# also host2 should be a valid hostname, and not point to another
# cname, warn if this is the case
#
if ( /[a-z0-9._-]+\tIN\tCNAME\t[a-z0-9._-]+/i ) {
@field = split("\t", $_ );
$add = 0; # do we add this entry to list?
$strange = 0; # do we have a strange entry - if so warn
# simplest case, breakout if we've done this one (on a previous pass)
next if defined( $cname{ $field[0] } ) && ( $cname{ $field[0] } eq
$field[3] );
# check the right hand side term is ok and has a %hostname entry
# complain about fully qualified local names
# and complain about a rhs which is itself a CNAME entry
if ( $hostname{ $field[3] } ) {
$add = 1;
if ( &is_fqdn( $field[3] ) ) {
$strange = 1;
if ( &is_inthisdomain( $field[3], $domain_search) ) {
print "; WARNING '$field[3]' is fully qualified, should be
local\n";
print OUTFILE "; WARNING '$field[3]' is fully qualified, should be
local\n";
}
else {
# shouldn't get here I think?
print "; WARNING '$field[3]' is outside this domain\n";
print OUTFILE "; WARNING '$field[3]' is outside this domain\n";
}
}
}
# check the left hand-side
# if we find a $hostname entry this is an error
if ( $hostname{ $field[0] } ) {
$add = 1;
if ( &is_fqdn( $field[0] ) ) {
$strange = 1;
if ( &is_inthisdomain( $field[0], $domain_search) ) {
print "; WARNING '$field[0]' is fully qualified, should be
local\n";
print OUTFILE "; WARNING '$field[0]' is fully qualified, should be
local\n";
}
else {
# shouldn't get here I think?
To be continued in digest: tcp_97_5C
Read previous mail | Read next mail
| |