Skip to content

Commit

Permalink
fix: page limit
Browse files Browse the repository at this point in the history
  • Loading branch information
thehappydinoa committed May 8, 2023
1 parent a490426 commit 7920b5e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions censys-subdomain-finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@

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


# Finds subdomains of a domain using Censys API
def find_subdomains(domain, api_id, api_secret, limit_results):
Expand All @@ -26,11 +30,15 @@ def find_subdomains(domain, api_id, api_secret, limit_results):
certificate_query = "names: %s" % domain
if limit_results:
certificates_search_results = censys_certificates.search(
certificate_query, fields=["names"], per_page=100, pages=10
certificate_query,
per_page=MAX_PER_PAGE,
pages=COMMUNITY_MAX_PAGES,
)
else:
certificates_search_results = censys_certificates.search(
certificate_query, fields=["names"]
certificate_query,
per_page=MAX_PER_PAGE,
pages=MAX_PAGES
)

# Flatten the result, and remove duplicates
Expand Down Expand Up @@ -133,7 +141,7 @@ def main(domain, output_file, censys_api_id, censys_api_secret, limit_results):

limit_results = not args.commercial
if limit_results:
print("[*] Applying non-commercial limits (1000 results at most)")
print(f"[*] Applying free plan limits ({MAX_PER_PAGE * COMMUNITY_MAX_PAGES} results at most)")

if None in [censys_api_id, censys_api_secret]:
sys.stderr.write(
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
censys==2.2.0
censys==2.2.1
python-dotenv

0 comments on commit 7920b5e

Please sign in to comment.