Skip to content

Commit 11970ea

Browse files
authoredMay 30, 2021
Better solution for output problems
1 parent 5a48a3e commit 11970ea

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed
 

‎dnscan.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,22 @@ def __init__(self, queue):
5858

5959
def get_name(self, domain):
6060
global wildcard, addresses
61+
size = int(os.popen('stty size', 'r').read().split()[1]) - 1 # Get terminal width in order to clean output later
6162
try:
6263
if sys.stdout.isatty(): # Don't spam output if redirected
63-
sys.stdout.write(domain + " \r")
64+
sys.stdout.write(domain + " " * (size - domain) + "\r")
6465
sys.stdout.flush()
6566
res = lookup(domain, recordtype)
6667
if args.tld and res:
6768
nameservers = sorted(list(res))
6869
ns0 = str(nameservers[0])[:-1] # First nameserver
70+
sys.stdout.write(" " * size + "\r")
71+
sys.stdout.flush()
6972
print(domain + " - " + col.brown + ns0 + col.end)
7073
if args.tld:
7174
if res:
75+
sys.stdout.write(" " * size + "\r")
76+
sys.stdout.flush()
7277
print(domain + " - " + res)
7378
return
7479
for rdata in res:
@@ -77,6 +82,8 @@ def get_name(self, domain):
7782
for wildcard_ip in wildcard:
7883
if address == wildcard_ip:
7984
return
85+
sys.stdout.write(" " * size + "\r")
86+
sys.stdout.flush()
8087
if args.domain_first:
8188
print(domain + " - " + col.brown + address + col.end)
8289
else:

0 commit comments

Comments
 (0)
Please sign in to comment.