Table Align to Left.

Aligned Table to left for better looks. ;)
This commit is contained in:
Touhid M Shaikh 2019-03-22 19:06:33 +05:30 committed by GitHub
parent cf4c0ca37d
commit 39f43948ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -26,6 +26,7 @@ import socket
import time import time
from collections import Counter from collections import Counter
from prettytable import PrettyTable from prettytable import PrettyTable
# external modules # external modules
# from subbrute import subbrute # from subbrute import subbrute
import dns.resolver import dns.resolver
@ -1146,7 +1147,12 @@ if __name__ == "__main__":
# Code added here # Code added here
if (analyze): if (analyze):
cnametable = PrettyTable(["Name", "Records"]) cnametable = PrettyTable(["Name", "Records"])
cnametable.align["Name"] = "l"
cnametable.align["Records"] = "l"
atable = PrettyTable(["Name", "Records"]) 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']
@ -1168,6 +1174,7 @@ if __name__ == "__main__":
elif rtype == "A": elif rtype == "A":
i = [name,record] i = [name,record]
atable.add_row(i) 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)
@ -1185,6 +1192,7 @@ 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
print cnames print cnames
print cnametable print cnametable
@ -1192,6 +1200,7 @@ if __name__ == "__main__":
print atable print atable
# output analysis results to console # output analysis results to console
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" result = ahosts + "\n" + str(atable) + "\n" + cnames + "\n" + str(cnametable) + "\n"