Adde base conf loader
Remove TOTO
This commit is contained in:
parent
a6d5f3026d
commit
fca78832d8
41
HTTPy.py
41
HTTPy.py
@ -22,6 +22,47 @@ 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 ="
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user