Refactoring to allow for multithreading later

This commit is contained in:
Benjamyn Love 2018-02-25 00:13:36 +11:00
parent 266ba314b3
commit 927cdeb86d
2 changed files with 14 additions and 4 deletions

BIN
.HTTPy.py.swp Normal file

Binary file not shown.

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:
@ -140,10 +143,14 @@ def iterate(inArray, pre):
else:
if checkIfIP(inArray[count].split('.')) == 0:
tmpVal = isCNAME(inArray[count])
print indent + bcolors.CYAN + pre, bcolors.GREEN + inArray[count] + bcolors.RESET + " -> " + bcolors.GREEN + tmpVal[0] + bcolors.RESET
recordDict[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:
print indent + bcolors.CYAN + pre, bcolors.GREEN + inArray[count] + bcolors.RESET
recordDict[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
@ -288,4 +295,7 @@ while running == 1:
else:
dnsRec, dnsType, blank = newdig(inInput, rec)
iterate(dnsRec, dnsType)
#pprint(recordDict)
for data in recordDict:
print recordDict[data]
print '\n'