Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1b26c0f7b1 | ||
|
|
dc5769a819 | ||
|
|
927cdeb86d | ||
|
|
266ba314b3 | ||
|
|
7d20140563 |
No files matched your search
@@ -1,9 +1,13 @@
|
|||||||
|
#!/usr/bin/python2.7
|
||||||
import subprocess
|
import subprocess
|
||||||
import re # YAY REVERSE ENGINEER... wait its just regex
|
import re # YAY REVERSE ENGINEER... wait its just regex
|
||||||
import readline
|
import readline
|
||||||
import os
|
import os
|
||||||
|
from pprint import pprint
|
||||||
#Made this work with linux magic, test
|
#Made this work with linux magic, test
|
||||||
|
|
||||||
|
recordDict = {}
|
||||||
|
|
||||||
#Define Colours
|
#Define Colours
|
||||||
class bcolors:
|
class bcolors:
|
||||||
RED = "\033[1;31m"
|
RED = "\033[1;31m"
|
||||||
@@ -22,7 +26,7 @@ running = 1
|
|||||||
pingOn = "p"
|
pingOn = "p"
|
||||||
whoOn = "W"
|
whoOn = "W"
|
||||||
phrases = ["ping", "whois", "quit", "clear", "help", "nameserver"]
|
phrases = ["ping", "whois", "quit", "clear", "help", "nameserver"]
|
||||||
indent = '> '
|
indent = '~ '
|
||||||
|
|
||||||
def openFile(filename):
|
def openFile(filename):
|
||||||
try:
|
try:
|
||||||
@@ -133,25 +137,34 @@ def options(inputs):
|
|||||||
def iterate(inArray, pre):
|
def iterate(inArray, pre):
|
||||||
count = 0
|
count = 0
|
||||||
while count != len(inArray) - 1:
|
while count != len(inArray) - 1:
|
||||||
|
print pre
|
||||||
#print checkIfIP(inArray[count].split('.'))
|
#print checkIfIP(inArray[count].split('.'))
|
||||||
if pre == "TXT" or pre == "SOA":
|
if pre == "TXT" or pre == "SOA":
|
||||||
print indent + bcolors.CYAN + pre, bcolors.GREEN + inArray[count] + bcolors.RESET
|
print indent + bcolors.CYAN + pre, bcolors.GREEN + inArray[count] + bcolors.RESET
|
||||||
else:
|
else:
|
||||||
if checkIfIP(inArray[count].split('.')) == 0:
|
if checkIfIP(inArray[count].split('.')) == 0:
|
||||||
tmpVal = isCNAME(inArray[count])
|
tmpVal = isCNAME(inArray[count])
|
||||||
|
recordDict[pre + str(count)] = 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
|
#print indent + bcolors.CYAN + pre, bcolors.GREEN + inArray[count] + bcolors.RESET + " -> " + bcolors.GREEN + tmpVal[0] + bcolors.RESET
|
||||||
else:
|
else:
|
||||||
print indent + bcolors.CYAN + pre, bcolors.GREEN + inArray[count] + bcolors.RESET
|
recordDict[pre + str(count)] = 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
|
count = count + 1
|
||||||
|
|
||||||
|
|
||||||
def iterateMX(inArray, pre):
|
def iterateMX(inArray, pre):
|
||||||
|
global inInput
|
||||||
count = 0
|
count = 0
|
||||||
while count != len(inArray) - 1:
|
while count != len(inArray) - 1:
|
||||||
tmp = inArray[count].split(' ')
|
tmp = inArray[count].split(' ')
|
||||||
tmpVal = isCNAME(tmp[1])
|
if (len(tmp) == 1):
|
||||||
print indent + bcolors.CYAN + pre, bcolors.GREEN + inArray[count] + bcolors.RESET + " -> " + bcolors.GREEN + tmpVal[0] + bcolors.RESET
|
pass
|
||||||
|
else:
|
||||||
|
tmpVal = isCNAME(tmp[1])
|
||||||
|
print indent + bcolors.CYAN + pre, bcolors.GREEN + inArray[count] + bcolors.RESET + " -> " + bcolors.GREEN + tmpVal[0] + bcolors.RESET
|
||||||
count = count + 1
|
count = count + 1
|
||||||
|
|
||||||
def parseWhois(whioisInfo):
|
def parseWhois(whioisInfo):
|
||||||
@@ -193,10 +206,10 @@ def dig(inDomain, record):
|
|||||||
dig = subprocess.check_output(["dig", record, "+short", inDomain])
|
dig = subprocess.check_output(["dig", record, "+short", inDomain])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
dig = "error"
|
dig = "error"
|
||||||
print str(e)
|
#print str(e)
|
||||||
print "========================================================"
|
print "========================================================"
|
||||||
test = dig.split("\n")
|
test = dig.split("\n")
|
||||||
iterate(test, record)
|
#iterate(test, record)
|
||||||
return test
|
return test
|
||||||
|
|
||||||
def newdig(inDomain, record, sub=""):
|
def newdig(inDomain, record, sub=""):
|
||||||
@@ -204,7 +217,7 @@ def newdig(inDomain, record, sub=""):
|
|||||||
dig = subprocess.check_output(["dig", record, "+short", inDomain])
|
dig = subprocess.check_output(["dig", record, "+short", inDomain])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
dig = "error"
|
dig = "error"
|
||||||
print str(e)
|
#print str(e)
|
||||||
#print "========================================================"
|
#print "========================================================"
|
||||||
test = dig.split("\n")
|
test = dig.split("\n")
|
||||||
#iterate(test, record)
|
#iterate(test, record)
|
||||||
@@ -237,9 +250,24 @@ def getInput():
|
|||||||
if inInput == "quit":
|
if inInput == "quit":
|
||||||
running = 0
|
running = 0
|
||||||
|
|
||||||
def isCNAME(CNAME):
|
def isCNAME(CNAME, DOMAIN=""):
|
||||||
retval = newdig(CNAME, "A")
|
if (DOMAIN == CNAME):
|
||||||
return retval[0]
|
return 0
|
||||||
|
else:
|
||||||
|
retval = newdig(CNAME, "A")
|
||||||
|
return retval[0]
|
||||||
|
|
||||||
|
def printDict(dictionary):
|
||||||
|
#for item in dictionary:
|
||||||
|
for item in sorted(dictionary.iterkeys()):
|
||||||
|
#print item
|
||||||
|
#if len(dictionary[item]) == 2:
|
||||||
|
# print indent + bcolors.CYAN + item, bcolors.GREEN + dictionary[item][1] + bcolors.RESET
|
||||||
|
#else:
|
||||||
|
# print indent + bcolors.CYAN + item, bcolors.GREEN + dictionary[item][1] + bcolors.RESET + " -> " + bcolors.GREEN + dictionary[item][2] + bcolors.RESET
|
||||||
|
pass
|
||||||
|
for key in sorted(dictionary.iterkeys()):
|
||||||
|
print "%s:" % (key)
|
||||||
|
|
||||||
|
|
||||||
#Main Loop
|
#Main Loop
|
||||||
@@ -271,7 +299,7 @@ while running == 1:
|
|||||||
if sub != "":
|
if sub != "":
|
||||||
tmpDom = sub + "." + inInput
|
tmpDom = sub + "." + inInput
|
||||||
subRec, subType, subDomain = newdig(tmpDom, "A", sub)
|
subRec, subType, subDomain = newdig(tmpDom, "A", sub)
|
||||||
iterate(subRec, subDomain)
|
#iterate(subRec, subDomain)
|
||||||
for rec in rec2check:
|
for rec in rec2check:
|
||||||
if rec != "":
|
if rec != "":
|
||||||
if rec == "MX":
|
if rec == "MX":
|
||||||
@@ -280,4 +308,8 @@ while running == 1:
|
|||||||
else:
|
else:
|
||||||
dnsRec, dnsType, blank = newdig(inInput, rec)
|
dnsRec, dnsType, blank = newdig(inInput, rec)
|
||||||
iterate(dnsRec, dnsType)
|
iterate(dnsRec, dnsType)
|
||||||
|
print(recordDict)
|
||||||
|
#for data in recordDict:
|
||||||
|
# print recordDict[data]
|
||||||
|
#printDict(recordDict)
|
||||||
print '\n'
|
print '\n'
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
## NOTES
|
||||||
|
# I am an idiot
|
||||||
|
# {'A': ('A', '172.217.25.142'), 'mail': ('mail', '172.217.25.133'), 'www': ('www', '172.217.25.132')}
|
||||||
|
# ~ MX 10 aspmx.l.google.com. -> 108.177.97.26
|
||||||
|
# ~ MX 30 alt2.aspmx.l.google.com. -> 74.125.201.26
|
||||||
|
# ~ MX 50 alt4.aspmx.l.google.com. -> 173.194.175.26
|
||||||
|
# ~ MX 20 alt1.aspmx.l.google.com. -> 64.233.168.26
|
||||||
|
# ~ MX 40 alt3.aspmx.l.google.com. -> 173.194.219.27
|
||||||
|
# ~ TXT "docusign=05958488-4752-4ef2-95eb-aa7ba8a3bd0e"
|
||||||
|
# ~ TXT "v=spf1 include:_spf.google.com ~all"
|
||||||
|
# {'A': ('A', '172.217.25.142'), 'mail': ('mail', '172.217.25.133'), 'www': ('www', '172.217.25.132')}
|
||||||
|
# {'A': ('A', '172.217.25.142'), 'mail': ('mail', '172.217.25.133'), 'www': ('www', '172.217.25.132'), 'NS': ('NS', 'ns3.google.com.', '216.239.36.10')}
|
||||||
|
# {'A': ('A', '172.217.25.142'), 'mail': ('mail', '172.217.25.133'), 'www': ('www', '172.217.25.132'), 'NS': ('NS', 'ns3.google.com.', '216.239.36.10')}
|
||||||
|
# ~ SOA ns1.google.com. dns-admin.google.com. 186901781 900 900 1800 60
|
||||||
|
# {'A': ('A', '172.217.25.142'), 'mail': ('mail', '172.217.25.133'), 'www': ('www', '172.217.25.132'), 'NS': ('NS', 'ns3.google.com.', '216.239.36.10')}
|
||||||
|
|
||||||
|
There are mutiple records added, i need a unique indentifier :(
|
||||||
|
Maybe just a counter or something #nfi
|
||||||
Reference in new issue
Block a user