Skip to content

Added -sc flag to specify sources to use #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed subdominator/__pycache__/subdominator.cpython-311.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
11 changes: 10 additions & 1 deletion subdominator/modules/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import argparse
import time as t
import random
import traceback

red = Fore.RED
green = Fore.GREEN
magenta = Fore.MAGENTA
Expand All @@ -15,6 +17,9 @@
bold = Style.BRIGHT
colors = [ green, cyan, blue]
random_color = random.choice(colors)

args = None

def cli():
try:
parser = argparse.ArgumentParser(add_help=False, usage=argparse.SUPPRESS,exit_on_error=False)
Expand All @@ -39,6 +44,8 @@ def cli():
parser.add_argument("-fw", "--filter-wildcards", action="store_true")
parser.add_argument("-oJ", "--output-json", type=str)
parser.add_argument("-s", "--silent", action="store_true")
parser.add_argument("-sc", "--sources", type=lambda s: s.split(","), help="Comma-separated list of sources")

global args

return parser.parse_args()
Expand All @@ -59,10 +66,12 @@ def cli():

except Exception as e:

print(f"[{bold}{blue}INFO{reset}]: {bold}{white}Unexpected Error: {traceback.format_exc()} {reset}")

pass

except KeyboardInterrupt as e:

print(f"\n[{bold}{blue}INF{reset}]: {bold}{white}CTRL+C Pressed{reset}")
print(f"\n[{bold}{blue}INFO{reset}]: {bold}{white}CTRL+C Pressed{reset}")

SystemExit
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
132 changes: 106 additions & 26 deletions subdominator/modules/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,81 @@
banners = banner()
username = get_username()

async def __initiate__(domain):
async def __initiate__(domain, provided_sources):
valid_sources = [
'abuseipdb', 'alienvault', 'anubis', 'bevigil', 'binaryedge', 'bufferover', 'builtwith', 'c99', 'censys',
'certspotter', 'chaos', 'coderog', 'columbusapi', 'commoncrawl', 'crtsh', 'cyfare', 'digitorus', 'fofa',
'dnsdumpster', 'dnsrepo', 'facebook', 'fullhunt', 'google', 'hackertarget', 'huntermap', 'intelx', 'leakix',
'merklemap', 'myssl', 'netlas', 'passivetotal', 'quake', 'rapidapi', 'rapiddns', 'rapidfinder', 'rapidscan',
'redhuntlabs', 'racent', 'rsecloud', 'securitytrails', 'shodan', 'shodanx', 'shrewdeye', 'sitedossier',
'subdomaincenter', 'trickest', 'urlscan', 'virustotal', 'waybackarchive', 'whoisxml', 'zoomeyeapi'
]

# If provided_sources is not None, validate each source
if provided_sources:
invalid_sources = [source for source in provided_sources if source not in valid_sources]
if invalid_sources:
print(f"[{bold}{red}WRN{reset}]: {bold}{white}Error: The following sources are not valid: [{green}{', '.join(invalid_sources)}{bold}{white}]{reset}", file=sys.stderr)
exit()

# Filter the valid sources based on provided_sources
valid_sources = [source for source in valid_sources if source in provided_sources]

try:
async with aiohttp.ClientSession() as session:
tasks = [abuseipdb(domain, session, args),alienvault(domain, session, args), anubis(domain, session, args), bevigil(domain, session, configpath, username, args), binaryedge(domain, session, configpath, username, args),
bufferover(domain, session, configpath, username, args), builtwith(domain, session, configpath, username, args),c99(domain, session, configpath, username, args),censys(domain, session, configpath, username, args), certspotter(domain, session, configpath, username, args), chaos(domain, session, configpath, username, args),coderog(domain, session, configpath, username, args),
columbusapi(domain, session, args), commoncrawl(domain, args),crtsh(domain, session, args), cyfare(domain, session, args),digitorus(domain, session, args), fofa(domain,session, configpath, username, args),dnsdumpster(domain, session, configpath, username, args), dnsrepo(domain, session, args),
facebook(domain, session, configpath, username, args), fullhunt(domain, session, configpath, username, args), google(domain, session, configpath, username, args),hackertarget(domain, session, args), huntermap(domain, session, configpath, username, args),
intelx(domain, session, configpath, username, args), leakix(domain, session, configpath, username, args), merklemap(domain, args),myssl(domain, session, args),netlas(domain, session, configpath, username, args), passivetotal(domain, session, configpath, username, args),quake(domain, session, configpath, username, args),
rapidapi(domain, session, configpath, username, args), rapiddns(domain, session, args), rapidfinder(domain, session, configpath, username, args), rapidscan(domain, session, configpath, username, args),redhuntlabs(domain, session, configpath, username, args) ,racent(domain, session, args) ,rsecloud(domain, session, configpath, username, args) ,securitytrails(domain, session, configpath, username, args),
shodan(domain, session, configpath, username, args), shodanx(domain, session, args), shrewdeye(domain, session, args), sitedossier(domain, session, args), subdomaincenter(domain, session, args),trickest(domain, configpath, username, args),
urlscan(domain, session, args), virustotal(domain, session, configpath, username, args), waybackarchive(domain, args), whoisxml(domain, session, configpath, username, args), zoomeyeapi(domain, session, configpath, username, args)]
tasks = []
if 'abuseipdb' in valid_sources: tasks.append(abuseipdb(domain, session, args))
if 'alienvault' in valid_sources: tasks.append(alienvault(domain, session, args))
if 'anubis' in valid_sources: tasks.append(anubis(domain, session, args))
if 'bevigil' in valid_sources: tasks.append(bevigil(domain, session, configpath, username, args))
if 'binaryedge' in valid_sources: tasks.append(binaryedge(domain, session, configpath, username, args))
if 'bufferover' in valid_sources: tasks.append(bufferover(domain, session, configpath, username, args))
if 'builtwith' in valid_sources: tasks.append(builtwith(domain, session, configpath, username, args))
if 'c99' in valid_sources: tasks.append(c99(domain, session, configpath, username, args))
if 'censys' in valid_sources: tasks.append(censys(domain, session, configpath, username, args))
if 'certspotter' in valid_sources: tasks.append(certspotter(domain, session, configpath, username, args))
if 'chaos' in valid_sources: tasks.append(chaos(domain, session, configpath, username, args))
if 'coderog' in valid_sources: tasks.append(coderog(domain, session, configpath, username, args))
if 'columbusapi' in valid_sources: tasks.append(columbusapi(domain, session, args))
if 'commoncrawl' in valid_sources: tasks.append(commoncrawl(domain, args))
if 'crtsh' in valid_sources: tasks.append(crtsh(domain, session, args))
if 'cyfare' in valid_sources: tasks.append(cyfare(domain, session, args))
if 'digitorus' in valid_sources: tasks.append(digitorus(domain, session, args))
if 'fofa' in valid_sources: tasks.append(fofa(domain, session, configpath, username, args))
if 'dnsdumpster' in valid_sources: tasks.append(dnsdumpster(domain, session, configpath, username, args))
if 'dnsrepo' in valid_sources: tasks.append(dnsrepo(domain, session, args))
if 'facebook' in valid_sources: tasks.append(facebook(domain, session, configpath, username, args))
if 'fullhunt' in valid_sources: tasks.append(fullhunt(domain, session, configpath, username, args))
if 'google' in valid_sources: tasks.append(google(domain, session, configpath, username, args))
if 'hackertarget' in valid_sources: tasks.append(hackertarget(domain, session, args))
if 'huntermap' in valid_sources: tasks.append(huntermap(domain, session, configpath, username, args))
if 'intelx' in valid_sources: tasks.append(intelx(domain, session, configpath, username, args))
if 'leakix' in valid_sources: tasks.append(leakix(domain, session, configpath, username, args))
if 'merklemap' in valid_sources: tasks.append(merklemap(domain, args))
if 'myssl' in valid_sources: tasks.append(myssl(domain, session, args))
if 'netlas' in valid_sources: tasks.append(netlas(domain, session, configpath, username, args))
if 'passivetotal' in valid_sources: tasks.append(passivetotal(domain, session, configpath, username, args))
if 'quake' in valid_sources: tasks.append(quake(domain, session, configpath, username, args))
if 'rapidapi' in valid_sources: tasks.append(rapidapi(domain, session, configpath, username, args))
if 'rapiddns' in valid_sources: tasks.append(rapiddns(domain, session, args))
if 'rapidfinder' in valid_sources: tasks.append(rapidfinder(domain, session, configpath, username, args))
if 'rapidscan' in valid_sources: tasks.append(rapidscan(domain, session, configpath, username, args))
if 'redhuntlabs' in valid_sources: tasks.append(redhuntlabs(domain, session, configpath, username, args))
if 'racent' in valid_sources: tasks.append(racent(domain, session, args))
if 'rsecloud' in valid_sources: tasks.append(rsecloud(domain, session, configpath, username, args))
if 'securitytrails' in valid_sources: tasks.append(securitytrails(domain, session, configpath, username, args))
if 'shodan' in valid_sources: tasks.append(shodan(domain, session, configpath, username, args))
if 'shodanx' in valid_sources: tasks.append(shodanx(domain, session, args))
if 'shrewdeye' in valid_sources: tasks.append(shrewdeye(domain, session, args))
if 'sitedossier' in valid_sources: tasks.append(sitedossier(domain, session, args))
if 'subdomaincenter' in valid_sources: tasks.append(subdomaincenter(domain, session, args))
if 'trickest' in valid_sources: tasks.append(trickest(domain, configpath, username, args))
if 'urlscan' in valid_sources: tasks.append(urlscan(domain, session, args))
if 'virustotal' in valid_sources: tasks.append(virustotal(domain, session, configpath, username, args))
if 'waybackarchive' in valid_sources: tasks.append(waybackarchive(domain, args))
if 'whoisxml' in valid_sources: tasks.append(whoisxml(domain, session, configpath, username, args))
if 'zoomeyeapi' in valid_sources: tasks.append(zoomeyeapi(domain, session, configpath, username, args))

results = await asyncio.gather(*tasks)
return results
except KeyboardInterrupt as e:
Expand Down Expand Up @@ -209,10 +273,10 @@ def show_sources():
SystemExit


async def _domain_handler_(domain):
async def _domain_handler_(domain, provided_sources):
try:
start = time.time()
results = await __initiate__(domain)
results = await __initiate__(domain, provided_sources)
filtered = filters(results)
final= set()

Expand All @@ -237,20 +301,22 @@ async def _domain_handler_(domain):
end = time.time()
total_time = end - start
if not args.silent:
if args.no_color:
print(f"[INFO]: Total {len(final)} subdomains found for {domain} in {total_time:.2f} seconds", file=sys.stderr)
else:
print(f"[{bold}{blue}INFO{reset}]: {bold}{white}Total {len(final)} subdomains found for {domain} in {total_time:.2f} seconds{reset}", file=sys.stderr)

if args.no_color:
print(f"[WISH]: Happy Hacking {username} ☠️ 🔥 🚀", file=sys.stderr)
if args.sources:
print(f"[INFO]: Total {len(final)} subdomains found for {domain} in {total_time:.2f} from {len(args.sources)} sources [{', '.join(args.sources)}]", file=sys.stderr)
else:
print(f"[INFO]: Total {len(final)} subdomains found for {domain} in {total_time:.2f} seconds from all sources", file=sys.stderr)
else:
print(f"[{bold}{green}WISH{reset}]: {bold}{white}Happy Hacking {username} ☠️ 🔥 🚀{reset}", file=sys.stderr)
if args.sources:
print(f"[{bold}{blue}INFO{reset}]: {bold}{white}Total {len(final)} subdomains found for {domain} in {total_time:.2f} seconds from {len(args.sources)} sources [{green}{', '.join(args.sources)}{reset}{bold}{white}]{reset}", file=sys.stderr)
else:
print(f"[{bold}{blue}INFO{reset}]: {bold}{white}Total {len(final)} subdomains found for {domain} in {total_time:.2f} seconds seconds from all sources{reset}", file=sys.stderr)

except KeyboardInterrupt as e:
SystemExit


async def handler():
try:
if args.help:
Expand All @@ -265,27 +331,41 @@ async def handler():
show_sources()
if args.update or args.show_updates:
update_handler()
if args.domain:
if args.sources:
if not args.silent:
if not args.no_color:
print(f"[{bold}{blue}INFO{reset}]: {bold}{white}Loading provider configuration file from {configpath}{reset}", file=sys.stderr)
# Print info on sources provided
print(f"[{bold}{blue}INFO{reset}]: {bold}{white}Sources Provided: {len(args.sources)} [{green}{', '.join(args.sources)}{reset}{bold}{white}] {reset}", file=sys.stderr)
else:
print(f"[INFO]: Loading provider configuration file from {configpath}", file=sys.stderr)

print(f"[INFO]: Sources Provided: {len(args.sources)} [{', '.join(args.sources)}]", file=sys.stderr)
else:
if not args.silent:
if not args.no_color:
# Print info on sources provided
print(f"[{bold}{blue}INFO{reset}]: {bold}{white}Using all sources for enumeration [{green}Default{reset}{bold}{white}] {reset}", file=sys.stderr)
else:
print(f"[INFO]: Using all sources for enumeration [Default]", file=sys.stderr)

if args.domain:
if not args.silent:
if not args.no_color:
print(f"[{bold}{blue}INFO{reset}]: {bold}{white}Loading provider configuration file from {configpath}{reset}", file=sys.stderr)
print(f"[{bold}{blue}INFO{reset}]: {bold}{white}Enumerating subdomain for {args.domain}{reset}", file=sys.stderr)

else:
print(f"[INFO]: Loading provider configuration file from {configpath}", file=sys.stderr)
print(f"[INFO]: Enumerating subdomain for {args.domain}", file=sys.stderr)
await _domain_handler_(args.domain)

await _domain_handler_(args.domain, args.sources)
quit()

if args.domain_list:
if not args.silent:
if not args.no_color:
print(f"[{bold}{blue}INFO{reset}]: {bold}{white}Loading provider configuration file from {configpath}{reset}", file=sys.stderr)
else:
print(f"[INFO]: Loading provider configuration file from {configpath}", file=sys.stderr)

domains = reader(args.domain_list, args)
if domains:
for domain in domains:
Expand All @@ -294,7 +374,7 @@ async def handler():
print(f"[{bold}{blue}INFO{reset}]: {bold}{white}Enumerating subdomain for {domain}{reset}", file=sys.stderr)
else:
print(f"[INFO]: Enumerating subdomain for {domain}", file=sys.stderr)
await _domain_handler_(domain)
await _domain_handler_(domain, args.sources)
quit()

if sys.stdin.isatty():
Expand All @@ -312,7 +392,7 @@ async def handler():
print(f"[{bold}{blue}INFO{reset}]: {bold}{white}Enumerating subdomain for {domain}{reset}", file=sys.stderr)
else:
print(f"[INFO]: Enumerating subdomain for {domain}", file=sys.stderr)
await _domain_handler_(domain)
await _domain_handler_(domain, args.sources)
quit()
except KeyboardInterrupt as e:
quit()
Expand Down
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions subdominator/modules/help/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ def help(path):
-oD, --output-directory : directory name to save the outputs (use it when -dL is flag used).
-oJ, --output-json : filename to save output in json fromat

{bold}{white}[{reset}{bold}{blue}SOURCE{reset}{bold}{white}]{reset}: {bold}{white}

-sc, --sources : specify sources to use for enumeration (-sc crtsh,shodan).

{bold}{white}[{reset}{bold}{blue}OPTIMIZATION{reset}{bold}{white}]{reset}: {bold}{white}

-t, --timeout : timeout value for every sources requests.
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.