Skip to content

Commit

Permalink
Convert dictionary words to lower case before filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
elceef committed Oct 7, 2023
1 parent 8fd384f commit a5d3ffa
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions dnstwist.py
Original file line number Diff line number Diff line change
Expand Up @@ -1286,9 +1286,10 @@ def signal_handler(signal, frame):

dictionary = []
if args.dictionary:
re_subd = re.compile(r'^(?:(?:xn--)[a-z0-9-]{3,59}|[a-z0-9-]{1,63})$')
try:
with open(args.dictionary, encoding='utf-8') as f:
dictionary = [x for x in set(f.read().splitlines()) if x.isalnum()]
dictionary = [x for x in set(f.read().lower().splitlines()) if re_subd.match(x)]
except FileNotFoundError:
parser.error('file not found: {}'.format(args.dictionary))
except PermissionError:
Expand All @@ -1300,9 +1301,10 @@ def signal_handler(signal, frame):

tld = []
if args.tld:
re_tld = re.compile(r'^[a-z0-9-]{2,63}(?:\.[a-z0-9-]{2,63})?$')
try:
with open(args.tld, encoding='utf-8') as f:
tld = [x for x in set(f.read().splitlines()) if re.match(r'^[a-z0-9-]{2,63}(\.[a-z0-9-]{2,63}){0,1}$', x)]
tld = [x for x in set(f.read().lower().splitlines()) if re_tld.match(x)]
except FileNotFoundError:
parser.error('file not found: {}'.format(args.tld))
except PermissionError:
Expand Down

0 comments on commit a5d3ffa

Please sign in to comment.