Skip to content

Commit

Permalink
new: [functionality] catch all
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidCruciani committed Sep 12, 2023
1 parent 928ecaa commit b81f88e
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 47 deletions.
31 changes: 29 additions & 2 deletions ail_typo_squatting/typo.py
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,29 @@ def numeralSwap(domain, resultList, verbose, limit, givevariations=False, keepo
return resultList


def dnsResolving(resultList, domain, pathOutput, verbose=False, givevariations=False, dns_limited=False):
def catchAll(current_domain):
import dns.resolver

is_catch_all = False

chars = 'abcdefghijklmnopqrstuvwxyz0123456789'
ca_str = ''
for _ in range(10):
ca_str += random.choice(chars)

domain_catch_all = f"{ca_str}.{current_domain}"
try:
answer = dns.resolver.resolve(domain_catch_all, 'A')
if len(answer):
is_catch_all = True
except:
pass
if is_catch_all:
return domain_catch_all
return False


def dnsResolving(resultList, domain, pathOutput, verbose=False, givevariations=False, dns_limited=False, catch_all=False):
"""Do a dns resolving on each variations and then create a json"""

import dns.name
Expand Down Expand Up @@ -1270,6 +1292,8 @@ def dnsResolving(resultList, domain, pathOutput, verbose=False, givevariations=F
loc_dict[result]['NotExist'] = True
else:
loc_dict[result]['NotExist'] = False
if catch_all:
loc_dict[result]['CatchAll'] = catchAll(n)

if loc_dict:
domain_resolve[variation].append(loc_dict)
Expand All @@ -1296,6 +1320,8 @@ def dnsResolving(resultList, domain, pathOutput, verbose=False, givevariations=F
domain_resolve[result]['NotExist'] = True
else:
domain_resolve[result]['NotExist'] = False
if catch_all:
domain_resolve[result]['CatchAll'] = catchAll(n)

if pathOutput and not pathOutput == "-":
with open(f"{pathOutput}/{domain}_resolve.json", "w", encoding='utf-8') as write_json:
Expand Down Expand Up @@ -1468,6 +1494,7 @@ def runAll(domain, limit, formatoutput, pathOutput, verbose=False, givevariation
parser.add_argument("-addns", "--adddynamicdns", help="Add dynamic dns at the end of the domain", action="store_true")
parser.add_argument("-ns", "--numeralswap", help="Change a numbers to words and vice versa. Ex: circlone.lu, circl1.lu", action="store_true")
parser.add_argument("-combo", help="Combine multiple algo on a domain name", action="store_true")
parser.add_argument("-ca", "--catchall", help="Combine with -dnsr. Generate a random string in front of the domain.", action="store_true")

args = parser.parse_args()

Expand Down Expand Up @@ -1582,6 +1609,6 @@ def runAll(domain, limit, formatoutput, pathOutput, verbose=False, givevariation


if args.dnsresolving:
dnsResolving(resultList, domain, pathOutput, verbose, givevariations, dns_limited)
dnsResolving(resultList, domain, pathOutput, verbose, givevariations, dns_limited, args.catchall)

resultList = list()
98 changes: 54 additions & 44 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ail-typo-squatting"
version = "2.4.3"
version = "2.5.0"
description = "Generate list of domain name using Domain name permutation engine to feed AIL"
authors = [
"David Cruciani <[email protected]>"
Expand Down

0 comments on commit b81f88e

Please sign in to comment.