Skip to content

Commit

Permalink
chore: for commercial plans get all results
Browse files Browse the repository at this point in the history
  • Loading branch information
thehappydinoa committed May 9, 2023
1 parent 7920b5e commit 9e37bf6
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions censys-subdomain-finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
USER_AGENT = f"{CensysCerts.DEFAULT_USER_AGENT} (censys-subdomain-finder; +https://github.com/christophetd/censys-subdomain-finder)"

MAX_PER_PAGE = 100
COMMUNITY_MAX_PAGES = 10
MAX_PAGES = 50
COMMUNITY_PAGES = 10


# Finds subdomains of a domain using Censys API
Expand All @@ -28,18 +27,14 @@ def find_subdomains(domain, api_id, api_secret, limit_results):
api_id=api_id, api_secret=api_secret, user_agent=USER_AGENT
)
certificate_query = "names: %s" % domain
pages = -1 # unlimited
if limit_results:
certificates_search_results = censys_certificates.search(
certificate_query,
per_page=MAX_PER_PAGE,
pages=COMMUNITY_MAX_PAGES,
)
else:
certificates_search_results = censys_certificates.search(
certificate_query,
per_page=MAX_PER_PAGE,
pages=MAX_PAGES
)
pages = COMMUNITY_PAGES
certificates_search_results = censys_certificates.search(
certificate_query,
per_page=MAX_PER_PAGE,
pages=pages
)

# Flatten the result, and remove duplicates
subdomains = []
Expand Down Expand Up @@ -141,7 +136,11 @@ def main(domain, output_file, censys_api_id, censys_api_secret, limit_results):

limit_results = not args.commercial
if limit_results:
print(f"[*] Applying free plan limits ({MAX_PER_PAGE * COMMUNITY_MAX_PAGES} results at most)")
print(
f"[*] Applying free plan limits ({MAX_PER_PAGE * COMMUNITY_PAGES} results at most)"
)
else:
print("[*] No limits applied, getting all results")

if None in [censys_api_id, censys_api_secret]:
sys.stderr.write(
Expand Down

0 comments on commit 9e37bf6

Please sign in to comment.