hopes and dreams

This commit is contained in:
root 2018-02-15 09:07:24 +11:00
parent 7d20140563
commit 266ba314b3

View File

@ -148,11 +148,15 @@ def iterate(inArray, pre):
def iterateMX(inArray, pre): def iterateMX(inArray, pre):
global inInput
count = 0 count = 0
while count != len(inArray) - 1: while count != len(inArray) - 1:
tmp = inArray[count].split(' ') tmp = inArray[count].split(' ')
tmpVal = isCNAME(tmp[1]) if (len(tmp) == 1):
print indent + bcolors.CYAN + pre, bcolors.GREEN + inArray[count] + bcolors.RESET + " -> " + bcolors.GREEN + tmpVal[0] + bcolors.RESET pass
else:
tmpVal = isCNAME(tmp[1])
print indent + bcolors.CYAN + pre, bcolors.GREEN + inArray[count] + bcolors.RESET + " -> " + bcolors.GREEN + tmpVal[0] + bcolors.RESET
count = count + 1 count = count + 1
def parseWhois(whioisInfo): def parseWhois(whioisInfo):
@ -194,7 +198,7 @@ def dig(inDomain, record):
dig = subprocess.check_output(["dig", record, "+short", inDomain]) dig = subprocess.check_output(["dig", record, "+short", inDomain])
except Exception as e: except Exception as e:
dig = "error" dig = "error"
print str(e) #print str(e)
print "========================================================" print "========================================================"
test = dig.split("\n") test = dig.split("\n")
iterate(test, record) iterate(test, record)
@ -205,7 +209,7 @@ def newdig(inDomain, record, sub=""):
dig = subprocess.check_output(["dig", record, "+short", inDomain]) dig = subprocess.check_output(["dig", record, "+short", inDomain])
except Exception as e: except Exception as e:
dig = "error" dig = "error"
print str(e) #print str(e)
#print "========================================================" #print "========================================================"
test = dig.split("\n") test = dig.split("\n")
#iterate(test, record) #iterate(test, record)
@ -238,9 +242,12 @@ def getInput():
if inInput == "quit": if inInput == "quit":
running = 0 running = 0
def isCNAME(CNAME): def isCNAME(CNAME, DOMAIN=""):
retval = newdig(CNAME, "A") if (DOMAIN == CNAME):
return retval[0] return 0
else:
retval = newdig(CNAME, "A")
return retval[0]
#Main Loop #Main Loop
@ -281,4 +288,4 @@ while running == 1:
else: else:
dnsRec, dnsType, blank = newdig(inInput, rec) dnsRec, dnsType, blank = newdig(inInput, rec)
iterate(dnsRec, dnsType) iterate(dnsRec, dnsType)
print '\n' print '\n'