1#!/usr/bin/perl 2# 3# Copyright (C) Internet Systems Consortium, Inc. ("ISC") 4# 5# This Source Code Form is subject to the terms of the Mozilla Public 6# License, v. 2.0. If a copy of the MPL was not distributed with this 7# file, you can obtain one at https://mozilla.org/MPL/2.0/. 8# 9# See the COPYRIGHT file distributed with this work for additional 10# information regarding copyright ownership. 11 12use strict; 13 14die "Usage: makenames.pl zonename num_records" if (@ARGV != 2); 15my $zname = @ARGV[0]; 16my $nrecords = @ARGV[1]; 17 18my @chars = split("", "abcdefghijklmnopqrstuvwxyz"); 19 20print"\$TTL 300 ; 5 minutes 21\$ORIGIN $zname. 22@ IN SOA mname1. . ( 23 2011080201 ; serial 24 20 ; refresh (20 seconds) 25 20 ; retry (20 seconds) 26 1814400 ; expire (3 weeks) 27 600 ; minimum (1 hour) 28 ) 29 NS ns 30ns A 10.53.0.3\n"; 31 32srand; 33for (my $i = 0; $i < $nrecords; $i++) { 34 my $name = ""; 35 for (my $j = 0; $j < 8; $j++) { 36 my $r = rand 25; 37 $name .= $chars[$r]; 38 } 39 print "$name" . "\tIN\tA\t"; 40 my $x = int rand 254; 41 my $y = int rand 254; 42 my $z = int rand 254; 43 print "10.$x.$y.$z\n"; 44} 45 46