Split some code into libs directory

This commit is contained in:
benjamyn committed 2018-03-10 17:21:49 +11:00
1 parent 3028c4646e
commit 84b909e7cb
7 files changed
+32 -10

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
import files
import config
BIN
View File
Binary file not shown.
+12
View File
@@ -0,0 +1,12 @@
import files as f
import json
def readConf():
try:
jsonData = json.loads(f.openFile("config.json").read())
except Exception as e:
print e
jasonData = ""
return jsonData
BIN
View File
Binary file not shown.
+15
View File
@@ -0,0 +1,15 @@
def openFile(path):
try:
myFile = open(path)
except Exception as e:
print e
pass
return myFile
def closeFile(fileObj):
try:
fileObj.close()
except Exception as e:
print e
pass
BIN
View File
Binary file not shown.
+3 -10
View File
@@ -5,6 +5,7 @@ import signal
import dns.resolver
import json
from pprint import pprint
from libs import config
running = 0
prompt = '$ '
@@ -13,14 +14,6 @@ whoisrecs = ["NotFound", "DomainName", "Registrar", "Status", "UpdatedDate", "Cr
subdomains = ["www", "mail", "ftp"]
dnsrecords = ["A", "MX", "TXT", "NS", "SOA"]
def openFile(path):
try:
myfile = open(path)
except Exception as E:
print E + "< - most likely file not found"
pass
return myfile
def domainWhois(inData):
whoisData = whois.whois(inData).query()
return whois.Parser(inData, whoisData[1]).parse()
@@ -50,8 +43,8 @@ def parseInput(inData):
signal.signal(signal.SIGINT, signal_handler)
jsonData = json.loads(openFile("config.json").read())
jsonData = config.readConf()
pprint(jsonData)
print "root"
for rdata in dns.resolver.query('yahoo.com', 'A') :