Revision [1035]

This is an old revision of mkmockdb made by ChristopherTheodore on 2008-01-16 19:08:35.

 


#!/usr/bin/perl -w
# mkmockdb v1.0
# by Christopher Theodore: Rhodes

# This script (  $total_zones=100000  and  $records_per_zone=30  ), generated a file that was  2.2gb  in size.
# For a TLD, each Domain Name would be a zone, so:
#
#    1 domain name (and all it's records) = 1 zone
#    
#    "all it's records" = full sets for records. Dome domains will have many sub-domains.
#
# For the first run, use the current defaults and take a look at what is being printed into the mock.db and then
# change the $total_zones and $records_per_zone
#

use strict;

# Total number of mock zones
my $total_zones = 1;

# Number of "sets" of sub-domains resource records for each mock zone
my $records_per_zone = 1;

# mock Resource Record data by type
my $domain_record = "ABCDEFGHIJKLMNOPQRSTUVWXYZ.ABCDEFGHIJKLMNOPQRSTUVWXYZ.ABCDEF";
my $A_record = "IN A\t000.000.000.000";
my $NS_record = "IN NS\tns00.ABCDEFGHIJKLMNOPQRSTUVWXYZ.ABCDEFGHIJKLMNOPQRSTUVWXYZ.ABCDEF";
my $AAAA_record = "IN AAAA 0000:0000:0000:0000:0000:0000:0000:0000";
my $MX_record = "IN MX\t10 mail.ABCDEFGHIJKLMNOPQRSTUVWXYZ.ABCDEFGHIJKLMNOPQRSTUVWXYZ.ABCDEF";
my $TXT_record = "IN TXT\t\"###################################################################################################\"";
my $SOA_record = "\$TTL 0h\n $domain_record\t IN SOA\t $NS_record hostmaster.$MX_record \( 0000000000 0h 0h 0w 0h \)";

my $file_out = "mock.db";

if (open(OUTFILE, ">$file_out")) {
	    # Loop to generate mock zones
	    for (my $a=0;$a <= $total_zones;$a++) {

	            # Print out a standard Source of Authority - you only need one per zone.
	            print OUTFILE "#\n#ZONE NUMBER: $a \n#\n";
	            print OUTFILE "$SOA_record \n";
	            print OUTFILE "\t\t $NS_record \n";
	            print OUTFILE "\t\t $NS_record \n";
	            print OUTFILE "\t\t $MX_record \n";
	            print OUTFILE "\t\t $TXT_record \n";
	            print OUTFILE "\t\t $A_record \n";
	            print OUTFILE "\t\t $AAAA_record \n";
	 
	            # Loop to generate sets of domain/sub-domains resource record sets for each mock zone
	            for (my $b=0;$b <= $records_per_zone;$b++) {

	                    # Print out a common set of resource records
	                    print OUTFILE "#\n#RECORD NUMBER: $a \n#\n";
	                    print OUTFILE "$domain_record\t\t $NS_record \n";
	                    print OUTFILE "$domain_record\t\t $NS_record \n";
	                    print OUTFILE "$domain_record\t\t $MX_record \n";
	                    print OUTFILE "$domain_record\t\t $TXT_record \n";
	                    print OUTFILE "$domain_record\t\t $A_record \n";
	                    print OUTFILE "$domain_record\t\t $AAAA_record \n";

	            }

	    }

	    close(OUTFILE);

} else { 
	       print "ERROR\: $!\n"; die; 
}



ArchitectureTools
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki