Compare commits

...

3 Commits

2 changed files with 48 additions and 6 deletions

View File

@ -3,8 +3,11 @@ import subprocess
import re # YAY REVERSE ENGINEER... wait its just regex
import readline
import os
from pprint import pprint
#Made this work with linux magic, test
recordDict = {}
#Define Colours
class bcolors:
RED = "\033[1;31m"
@ -23,7 +26,7 @@ running = 1
pingOn = "p"
whoOn = "W"
phrases = ["ping", "whois", "quit", "clear", "help", "nameserver"]
indent = '> '
indent = '~ '
def openFile(filename):
try:
@ -134,16 +137,21 @@ def options(inputs):
def iterate(inArray, pre):
count = 0
while count != len(inArray) - 1:
print pre
#print checkIfIP(inArray[count].split('.'))
if pre == "TXT" or pre == "SOA":
print indent + bcolors.CYAN + pre, bcolors.GREEN + inArray[count] + bcolors.RESET
else:
if checkIfIP(inArray[count].split('.')) == 0:
tmpVal = isCNAME(inArray[count])
recordDict[pre + str(count)] = pre, inArray[count], tmpVal[0]
#recordDict[pre] = indent + bcolors.CYAN + pre, bcolors.GREEN + inArray[count] + bcolors.RESET + " -> " + bcolors.GREEN + tmpVal[0] + bcolors.RESET
print indent + bcolors.CYAN + pre, bcolors.GREEN + inArray[count] + bcolors.RESET + " -> " + bcolors.GREEN + tmpVal[0] + bcolors.RESET
#print indent + bcolors.CYAN + pre, bcolors.GREEN + inArray[count] + bcolors.RESET + " -> " + bcolors.GREEN + tmpVal[0] + bcolors.RESET
else:
print indent + bcolors.CYAN + pre, bcolors.GREEN + inArray[count] + bcolors.RESET
recordDict[pre + str(count)] = pre, inArray[count]
#recordDict[pre] = indent + bcolors.CYAN + pre, bcolors.GREEN + inArray[count] + bcolors.RESET
#print indent + bcolors.CYAN + pre, bcolors.GREEN + inArray[count] + bcolors.RESET
count = count + 1
@ -201,7 +209,7 @@ def dig(inDomain, record):
#print str(e)
print "========================================================"
test = dig.split("\n")
iterate(test, record)
#iterate(test, record)
return test
def newdig(inDomain, record, sub=""):
@ -249,6 +257,18 @@ def isCNAME(CNAME, DOMAIN=""):
retval = newdig(CNAME, "A")
return retval[0]
def printDict(dictionary):
#for item in dictionary:
for item in sorted(dictionary.iterkeys()):
#print item
#if len(dictionary[item]) == 2:
# print indent + bcolors.CYAN + item, bcolors.GREEN + dictionary[item][1] + bcolors.RESET
#else:
# print indent + bcolors.CYAN + item, bcolors.GREEN + dictionary[item][1] + bcolors.RESET + " -> " + bcolors.GREEN + dictionary[item][2] + bcolors.RESET
pass
for key in sorted(dictionary.iterkeys()):
print "%s:" % (key)
#Main Loop
testFile = openFile(os.path.expanduser('~/.httpy'))
@ -279,7 +299,7 @@ while running == 1:
if sub != "":
tmpDom = sub + "." + inInput
subRec, subType, subDomain = newdig(tmpDom, "A", sub)
iterate(subRec, subDomain)
#iterate(subRec, subDomain)
for rec in rec2check:
if rec != "":
if rec == "MX":
@ -288,4 +308,8 @@ while running == 1:
else:
dnsRec, dnsType, blank = newdig(inInput, rec)
iterate(dnsRec, dnsType)
print(recordDict)
#for data in recordDict:
# print recordDict[data]
#printDict(recordDict)
print '\n'

18
notes.txt Normal file
View File

@ -0,0 +1,18 @@
## NOTES
# I am an idiot
# {'A': ('A', '172.217.25.142'), 'mail': ('mail', '172.217.25.133'), 'www': ('www', '172.217.25.132')}
# ~ MX 10 aspmx.l.google.com. -> 108.177.97.26
# ~ MX 30 alt2.aspmx.l.google.com. -> 74.125.201.26
# ~ MX 50 alt4.aspmx.l.google.com. -> 173.194.175.26
# ~ MX 20 alt1.aspmx.l.google.com. -> 64.233.168.26
# ~ MX 40 alt3.aspmx.l.google.com. -> 173.194.219.27
# ~ TXT "docusign=05958488-4752-4ef2-95eb-aa7ba8a3bd0e"
# ~ TXT "v=spf1 include:_spf.google.com ~all"
# {'A': ('A', '172.217.25.142'), 'mail': ('mail', '172.217.25.133'), 'www': ('www', '172.217.25.132')}
# {'A': ('A', '172.217.25.142'), 'mail': ('mail', '172.217.25.133'), 'www': ('www', '172.217.25.132'), 'NS': ('NS', 'ns3.google.com.', '216.239.36.10')}
# {'A': ('A', '172.217.25.142'), 'mail': ('mail', '172.217.25.133'), 'www': ('www', '172.217.25.132'), 'NS': ('NS', 'ns3.google.com.', '216.239.36.10')}
# ~ SOA ns1.google.com. dns-admin.google.com. 186901781 900 900 1800 60
# {'A': ('A', '172.217.25.142'), 'mail': ('mail', '172.217.25.133'), 'www': ('www', '172.217.25.132'), 'NS': ('NS', 'ns3.google.com.', '216.239.36.10')}
There are mutiple records added, i need a unique indentifier :(
Maybe just a counter or something #nfi