Skip to content

Commit

Permalink
fix(censys): update module
Browse files Browse the repository at this point in the history
  • Loading branch information
thehappydinoa committed Oct 2, 2023
1 parent 76ce3b3 commit d207ca1
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions theHarvester/discovery/censysearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,24 @@ async def do_search(self) -> None:
cert_search = CensysCerts(
api_id=self.key[0],
api_secret=self.key[1],
user_agent=f"censys/{__version__} (theHarvester/{thehavester_version}); +/~https://github.com/laramies/theHarvester)",
user_agent=f"censys-python/{__version__} (theHarvester/{thehavester_version}); +/~https://github.com/laramies/theHarvester)",
)
except CensysUnauthorizedException:
raise MissingKey("Censys ID and/or Secret")

query = f"parsed.names: {self.word}"
query = f"names: {self.word}"
try:
response = cert_search.search(
query=query,
fields=["parsed.names", "metadata", "parsed.subject.email_address"],
fields=["names", "parsed.subject.email_address"],
max_records=self.limit,
)
for cert in response():
self.totalhosts.update(cert.get("parsed.names", []))
self.emails.update(cert.get("parsed.subject.email_address", []))
self.totalhosts.update(cert.get("names", []))
email_address = (
cert.get("parsed", {}).get("subject", {}).get("email_address", [])
)
self.emails.update(email_address)
except CensysRateLimitExceededException:
print("Censys rate limit exceeded")

Expand Down

0 comments on commit d207ca1

Please sign in to comment.