Added SOA check, code refactored and it seems to work :D

This commit is contained in:
Benjamyn Love 2017-07-12 13:15:33 +10:00
parent f25e577afc
commit b9b2f476a7
4 changed files with 156492 additions and 7 deletions

View File

@ -18,6 +18,34 @@ def printHelp():
print "========================================================" print "========================================================"
print "========================================================" print "========================================================"
def compareSOA(inNameservers, inDomain, origSOA):
dnsServer = '8.8.8.8'
soaRecords = []
count = 0
outSOA = ''
returnmsg = "SOA Good"
for nameserver in inNameservers:
if nameserver != '':
dnsServer = "@" + nameserver
try:
outSOA = subprocess.check_output(["dig", "SOA", dnsServer, "+short", inDomain])
except subprocess.CalledProcessError as e:
output = e.output
returncode = e.returncode
outSOAa = outSOA.split(' ')
#print outSOAa[2]
if len(outSOAa) != 1:
soaRecords.append(outSOAa[2])
for soa in soaRecords:
if soa != soaRecords[0]:
return "SOA Records don't Match"
return "SOA good"
#print soaRecords
def checkPhrase(inputs): def checkPhrase(inputs):
for word in phrases: for word in phrases:
if inputs == word: if inputs == word:
@ -62,6 +90,7 @@ def dig(inDomain, record):
test = dig.split("\n") test = dig.split("\n")
#print record, test[0] #print record, test[0]
iterate(test, record) #fix up mutiple record types... iterate(test, record) #fix up mutiple record types...
return test
def ipLookup(inDomain): def ipLookup(inDomain):
host = "N/A" host = "N/A"
@ -110,11 +139,11 @@ while running == 1:
whois(inInput) whois(inInput)
else: else:
pass pass
pass
#Condense dig calls #Condense dig calls
dig(inInput, "A") dig(inInput, "A")
dig(inInput, "MX") dig(inInput, "MX")
dig(inInput, "TXT") dig(inInput, "TXT")
dig(inInput, "NS") test = dig(inInput, "NS")
dig(inInput, "SRV") dig(inInput, "SRV")
dig(inInput, "SOA") soaRec = dig(inInput, "SOA")
print compareSOA(test, inInput, soaRec)

8
TODO
View File

@ -4,15 +4,15 @@
#TODO: Implement TLD/gTLD lists to check against. #TODO: Implement TLD/gTLD lists to check against.
#TODO: Add the ability to use the command line args to input the domain name #Invalid now: Add the ability to use the command line args to input the domain name
#DONE: Add Linux superiority mode :D, Removed win compat entirely #Complete: Add Linux superiority mode :D, Removed win compat entirely
#TODO: Add shell after lookup #Complete: Add shell after lookup
#TODO: LEARN REGEX #TODO: LEARN REGEX
#TODO: ADD GEOIP LOOKUPS + HOST COMMAND #Completed: ADD GEOIP LOOKUPS + HOST COMMAND
#TODO: Add extra nice features #TODO: Add extra nice features
#Full DNS record lookup #Full DNS record lookup

78228
re Normal file

File diff suppressed because it is too large Load Diff

78228
subprocess Normal file

File diff suppressed because it is too large Load Diff