mirror of
https://github.com/laramies/theHarvester.git
synced 2025-02-23 05:52:59 +08:00
Don't mix line endings. Always use LF for text files when committing. Ensure your `core.eol` is set to `native` using `git config` to get native line endings for your platform on checkout.
27 lines
985 B
Python
27 lines
985 B
Python
class Parser:
|
|
|
|
def __init__(self):
|
|
self.emails = set()
|
|
self.hosts = set()
|
|
|
|
def parse_dictionaries(self, results):
|
|
"""
|
|
Parse method to parse json results
|
|
:param results: Dictionary containing a list of dictionaries known as selectors
|
|
:return: tuple of emails and hosts
|
|
"""
|
|
if results is not None:
|
|
for dictionary in results["selectors"]:
|
|
field = dictionary['selectorvalue']
|
|
if '@' in field:
|
|
self.emails.add(field)
|
|
else:
|
|
field = str(field)
|
|
if 'http' in field or 'https' in field:
|
|
if field[:5] == 'https':
|
|
field = field[8:]
|
|
else:
|
|
field = field[7:]
|
|
self.hosts.add(field.replace(')', '').replace(',', ''))
|
|
return self.emails, self.hosts
|
|
return None, None
|