Men&Mice Perl Script to add/edit DNS Records

 

The following perl script will add records to a Men&Mice controlled DNS server. It only has been tested on “A” records. And Only accepts two commands, A for add and E for edit. Typing the command by itself or using the -h option will show a help message:

Usage:
 ./mm_modrecords.pl: -h -d -m master-server -u user -p password -z zone_name -r "comment"
 where:
 -p password to M&M Central
 -m Master server default: ronin.eng.localdomain.local
 -c central server default= jumbo.eng.localdomain.local
 -s show the zone specified in -z and exit
 -l show zone history for zone specified by -z and exit
 -f file of records. see below for examples
 -e execute the edit command in the file
 -d debug mode
 -h this message
By default the records will be added to the primary server
File format examples
 "#" is a comment
 the semi-colon is necessary
 A=add E=edit
 E: test.com 86400 A 1.1.1.1 ; this is the file comment 1
 E: www.test.com 86400 A 2.2.2.2 4.4.4.4 ; this is the record comment.
    usually want this blank
 #E: www.test.com A 2.2.2.2 3.3.3.3;
 #A: ww2.test.com 86400 A 1.1.1.1 ; will produce error if already exist
 E: ww2.test.com 86400 A 1.1.1.1 ; will produce error snce there is no ip to
     change it to.examples:
 ./mm_addrecords.pl -f zonerecords.txt -c centralserver -p adminpassword -z test.com -l
 ./mm_addrecords.pl -f zonerecords.txt -c centralserver -p adminpassword -e

And here is the script:

mm_modrecords.pl


Leave a Reply