Skip to content

Commit

Permalink
Better line clearing to fix issues with some unicode characters in TL…
Browse files Browse the repository at this point in the history
…D scans
  • Loading branch information
rbsec committed May 23, 2022
1 parent a9abb88 commit 48fa99b
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions dnscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,25 +61,19 @@ def get_name(self, domain):
global wildcard, addresses
try:
if sys.stdout.isatty(): # Don't spam output if redirected
size = int(os.popen('stty size', 'r').read().split()[1]) - 1 # Get terminal width in order to clean output later
sys.stdout.write(domain + " " * (size - len(domain)) + "\r")
sys.stdout.flush()
else:
print(domain + '\033[K\r', end='')

size = 0
res = lookup(domain, recordtype)
if args.tld and res:
nameservers = sorted(list(res))
ns0 = str(nameservers[0])[:-1] # First nameserver
sys.stdout.write(" " * size + "\r")
sys.stdout.flush()
print('\033[K\r', end='')
print(domain + " - " + col.brown + ns0 + col.end)
if outfile:
print(ns0 + " - " + domain, file=outfile)
if args.tld:
if res:
sys.stdout.write(" " * size + "\r")
sys.stdout.flush()
print('\033[K\r', end='')
print(domain + " - " + res)
return
for rdata in res:
Expand All @@ -88,8 +82,7 @@ def get_name(self, domain):
for wildcard_ip in wildcard:
if address == wildcard_ip:
return
sys.stdout.write(" " * size + "\r")
sys.stdout.flush()
print('\033[K\r', end='')
if args.no_ip:
print(col.brown + domain + col.end)
break
Expand Down Expand Up @@ -392,7 +385,6 @@ def setup():
except:
out.fatal("Could not open wordlist " + args.wordlist)
sys.exit(1)

# Number of threads should be between 1 and 32
if args.threads < 1:
args.threads = 1
Expand Down

0 comments on commit 48fa99b

Please sign in to comment.