diff --git a/HTTPy.py b/HTTPy.py index 45c7b1b..39bcb77 100755 --- a/HTTPy.py +++ b/HTTPy.py @@ -21,7 +21,48 @@ running = 1 pingOn = "p" whoOn = "W" phrases = ["ping", "whois", "quit", "clear", "help", "nameserver"] - + +def openFile(filename): + try: + myfile = open(filename) + except Exception as E: + print E + print 'Creating default config file' + myfile = open(filename, 'w') + myfile.write('records=A:MX:TXT:NS:SRV:SOA\n') + myfile.write('subdomains=www:mail') + myfile.close() + return 1 + return myfile + +def closeFile(fileObj): + try: + fileObj.close() + except Exception as E: + print E + return 1 + return 0 +#Check and see if python can do pairs +def splitLines(confline): + tmpLine = confline.split('\n') + retval = [] + for line in tmpLine: + if line != '': + tmpLines = line.split('=') + retval.append(tmpLines[1].split(':')) + return retval + +testFile = openFile('.httpy') +test = testFile.read() +test1, test2 = splitLines(test) + +for t1 in test1: + print "dig " + t1 + +for t2 in test2: + print "dig " + t2 +closeFile(testFile) + def printHelp(): print bcolors.BLUE + "========================================================" print "= help - This screen =" diff --git a/TOTO b/TOTO deleted file mode 120000 index 30404ce..0000000 --- a/TOTO +++ /dev/null @@ -1 +0,0 @@ -TODO \ No newline at end of file