dns entry creator – python3

This is a python application I made to create large dns entries that could be cut and pasted.
Eventually, I’d like to get this into a gui format, so I can use it in gui mode. It’s not finished,
just wanted to show the new plugin that was installed.
Thought it might be useful ;)

#!/usr/bin/env python3
# Author: Crouse
# Create DNS entries for fwd and rev.
import os
firstip=""
lastip=""
hostname=""
domain=""
 
#test
#os.system('notepad.exe ' + "forward.txt")
# It works
 
# Function List
def Header_():
   os.system(['clear','cls'][os.name == 'nt'])
   print ("--------------------------------\n")
   print ("------ THE DNS TOOL -v1   ------\n")
   print ("------------------------dkc-----\n")
   print ()
 
def REVIP_():
   print ("do somethihnehere")
 
def FWDIP_():
   print ("do somethihnehere")
 
Header_()
 
#######################
 
firstip=input("Enter the 4 octets of the first IP: ")
Octets=firstip.split(".")
oct1 = int(Octets[0])
oct2 = int(Octets[1])
oct3 = int(Octets[2])
oct4 = int(Octets[3])
 
lastip=input("Enter the last octet of the ending ip:
"+Octets[0]+"."+Octets[1]+"."+Octets[2]+".")
oct5 = int(lastip)
 
hostname=input("Enter the hostname/in format of: ")
domain=input("Enter domain name: ")
 
#######################
 
#for i in range (oct4,oct5+1):
#     j='%03d' % (i)
#     print ('IP address {0}.{1}.{2}.{3}'.format(oct1, oct2, oct3, j))
 
print ()
print ("The reverse named.conf")
#rev named
# zone "3.2.1.in-addr.arpa" { type master; file "reverse/3.2.1.rev"; };
print ('zone \"{2}.{1}.{0}.in-addr.arpa\" {{ type master; file
"reverse/{2}.{1}.{0}.rev"; }};'.format(oct1, oct2, oct3))
 
print ()
print ("The reverse")
print ()
# rev format
# 1   IN   PTR   crouse-001.somedomain.net.
for i in range (oct4,oct5+1):
    j='%03d' % (i)
    print ('{0}    IN  PTR {1}-{2}.{3}.'.format(i, hostname, j, domain))
 
print ()
print ()
print ()
# fwd format
# crouse-001.somedomain.net.   IN   A   1.2.3.1
print ()
print ("The forward")
for i in range (oct4,oct5+1):
    j='%03d' % (i)
    print ('{0}-{1}.{2}.   IN  A   {3}.{4}.{5}.{6}'.format(hostname,j, domain, oct1, oct2, oct3, i))
 
temp = input("Hit any key to exit")

2 Comments

  1. haxit says:

    I activated the plugin and followed the instructions. It still doesn’t work. Check it out on my latest post.

  2. haxit says:

    Never mind, stupid GUI editor messed it up :P