diff --git a/HTTPy.py b/HTTPy.py index 77ab11b..8e16c7e 100755 --- a/HTTPy.py +++ b/HTTPy.py @@ -143,12 +143,12 @@ def iterate(inArray, pre): else: if checkIfIP(inArray[count].split('.')) == 0: tmpVal = isCNAME(inArray[count]) - recordDict[pre] = inArray[count], tmpVal[0] + recordDict[pre] = 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 else: - recordDict[pre] = inArray[count] + recordDict[pre] = 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 @@ -256,6 +256,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')) @@ -296,6 +308,7 @@ while running == 1: dnsRec, dnsType, blank = newdig(inInput, rec) iterate(dnsRec, dnsType) #pprint(recordDict) - for data in recordDict: - print recordDict[data] + #for data in recordDict: + # print recordDict[data] + printDict(recordDict) print '\n'