Merge pull request #6 from fleetcaptain/revert-5-touhidshaikh-table-added
Revert "Table added"
This commit is contained in:
commit
14d52ade3f
|
|
@ -25,7 +25,6 @@ import threading
|
||||||
import socket
|
import socket
|
||||||
import time
|
import time
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
from prettytable import PrettyTable
|
|
||||||
|
|
||||||
# external modules
|
# external modules
|
||||||
# from subbrute import subbrute
|
# from subbrute import subbrute
|
||||||
|
|
@ -1031,8 +1030,8 @@ def main(domain, threads, savefile, ports, silent, verbose, enable_bruteforce, e
|
||||||
|
|
||||||
|
|
||||||
# Method code added
|
# Method code added
|
||||||
cnames = '\033[94m== CNAME records ==\033[0m'
|
cnames = ['\033[94m== CNAME records ==\033[0m']
|
||||||
ahosts = '\033[94m== A records ==\033[0m'
|
ahosts = ['\033[94m== A records ==\033[0m']
|
||||||
|
|
||||||
|
|
||||||
def lookup(guess, name_server):
|
def lookup(guess, name_server):
|
||||||
|
|
@ -1141,19 +1140,8 @@ if __name__ == "__main__":
|
||||||
else:
|
else:
|
||||||
res = main(domain, threads, savefile, ports, silent=False, verbose=verbose, enable_bruteforce=enable_bruteforce,engines=engines)
|
res = main(domain, threads, savefile, ports, silent=False, verbose=verbose, enable_bruteforce=enable_bruteforce,engines=engines)
|
||||||
|
|
||||||
# Code added here
|
|
||||||
|
|
||||||
|
|
||||||
# Code added here
|
# Code added here
|
||||||
if (analyze):
|
if (analyze):
|
||||||
cnametable = PrettyTable(["Name", "Records"])
|
|
||||||
cnametable.align["Name"] = "l"
|
|
||||||
cnametable.align["Records"] = "l"
|
|
||||||
|
|
||||||
atable = PrettyTable(["Name", "Records"])
|
|
||||||
atable.align["Name"] = "l"
|
|
||||||
atable.align["Records"] = "l"
|
|
||||||
|
|
||||||
# res is the list of subdomains e.g. www.example.com, mail.example.com, etc
|
# res is the list of subdomains e.g. www.example.com, mail.example.com, etc
|
||||||
resolvers = ['8.8.8.8', '8.8.4.4', '9.9.9.9', '1.1.1.1', '1.0.0.1']
|
resolvers = ['8.8.8.8', '8.8.4.4', '9.9.9.9', '1.1.1.1', '1.0.0.1']
|
||||||
server = 0
|
server = 0
|
||||||
|
|
@ -1168,13 +1156,9 @@ if __name__ == "__main__":
|
||||||
# if the query did not return an error, then add result to appropriate array
|
# if the query did not return an error, then add result to appropriate array
|
||||||
if rtype != "ERROR":
|
if rtype != "ERROR":
|
||||||
if rtype == "CNAME":
|
if rtype == "CNAME":
|
||||||
i = [name,record]
|
cnames.append(name + " -->-- " + record)
|
||||||
cnametable.add_row(i)
|
|
||||||
|
|
||||||
elif rtype == "A":
|
elif rtype == "A":
|
||||||
i = [name,record]
|
ahosts.append(name + " -->-- " + record)
|
||||||
atable.add_row(i)
|
|
||||||
|
|
||||||
# round robin the resolvers
|
# round robin the resolvers
|
||||||
server = server + 1
|
server = server + 1
|
||||||
server = server % len(resolvers)
|
server = server % len(resolvers)
|
||||||
|
|
@ -1192,20 +1176,17 @@ if __name__ == "__main__":
|
||||||
# Known errors: subdomain sample starting with a dot, ex .domain.com
|
# Known errors: subdomain sample starting with a dot, ex .domain.com
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
ahosts.sort()
|
||||||
|
cnames.sort()
|
||||||
|
|
||||||
print cnames
|
|
||||||
print cnametable
|
|
||||||
|
|
||||||
print ahosts
|
|
||||||
print atable
|
|
||||||
# output analysis results to console
|
# output analysis results to console
|
||||||
|
for x in range(0, len(ahosts)):
|
||||||
|
print(G + ahosts[x] + W)
|
||||||
|
print("\n")
|
||||||
|
for x in range(0, len(cnames)):
|
||||||
|
print(G + cnames[x] + W)
|
||||||
|
|
||||||
if (analysisfile!=None):
|
if (analysisfile!=None):
|
||||||
# save the analysis to a file. Merge the arrays into one list for easier reading
|
# save the analysis to a file. Merge the arrays into one list for easier reading
|
||||||
result = ahosts + "\n" + str(atable) + "\n" + cnames + "\n" + str(cnametable) + "\n"
|
write_file(analysisfile, ahosts + ["\n"] + cnames)
|
||||||
|
print(B + "Saved reverse DNS analysis to " + analysisfile + W)
|
||||||
file = open(analysisfile,"w")
|
|
||||||
file.write(result)
|
|
||||||
file.close()
|
|
||||||
print(B + "Saved reverse DNS analysis to " + R + analysisfile + W)
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue