forked from smicallef/spiderfoot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Moved common SSL event functions to common_ssl_cert.py 2. Change sfp_crt and sfp_sslcert accordingly. 3. Allowed sfp_company to grab the O= portion of cert subject as full name (not limited to 3 words) fixes smicallef#1749
- Loading branch information
1 parent
f4494a8
commit 4373057
Showing
4 changed files
with
77 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from spiderfoot import SpiderFootEvent | ||
|
||
def process_ssl_cert_events(spiderfoot_plugin, cert, root_event): | ||
eventName = root_event.eventType | ||
|
||
if cert.get('issued'): | ||
new_event = SpiderFootEvent('SSL_CERTIFICATE_ISSUED', cert['issued'], spiderfoot_plugin.__name__, root_event) | ||
spiderfoot_plugin.notifyListeners(new_event) | ||
|
||
if cert.get('issuer'): | ||
new_event = SpiderFootEvent('SSL_CERTIFICATE_ISSUER', cert['issuer'], spiderfoot_plugin.__name__, root_event) | ||
spiderfoot_plugin.notifyListeners(new_event) | ||
|
||
if eventName != "IP_ADDRESS" and cert.get('mismatch'): | ||
new_event = SpiderFootEvent('SSL_CERTIFICATE_MISMATCH', ', '.join(cert.get('hosts')), spiderfoot_plugin.__name__, root_event) | ||
spiderfoot_plugin.notifyListeners(new_event) | ||
|
||
for san in set(cert.get('altnames', list())): | ||
domain = san.replace("*.", "") | ||
|
||
if spiderfoot_plugin.getTarget().matches(domain, includeChildren=True): | ||
new_event_type = 'INTERNET_NAME' | ||
if spiderfoot_plugin.opts['verify'] and not spiderfoot_plugin.sf.resolveHost(domain) and not spiderfoot_plugin.sf.resolveHost6(domain): | ||
spiderfoot_plugin.debug(f"Host {domain} could not be resolved") | ||
new_event_type += '_UNRESOLVED' | ||
else: | ||
new_event_type = 'CO_HOSTED_SITE' | ||
|
||
new_event = SpiderFootEvent(new_event_type, domain, spiderfoot_plugin.__name__, root_event) | ||
spiderfoot_plugin.notifyListeners(new_event) | ||
|
||
if spiderfoot_plugin.sf.isDomain(domain, spiderfoot_plugin.opts['_internettlds']): | ||
if new_event_type == 'CO_HOSTED_SITE': | ||
new_event = SpiderFootEvent('CO_HOSTED_SITE_DOMAIN', domain, spiderfoot_plugin.__name__, root_event) | ||
spiderfoot_plugin.notifyListeners(new_event) | ||
else: | ||
new_event = SpiderFootEvent('DOMAIN_NAME', domain, spiderfoot_plugin.__name__, root_event) | ||
spiderfoot_plugin.notifyListeners(new_event) | ||
|
||
if cert.get('expired'): | ||
new_event = SpiderFootEvent("SSL_CERTIFICATE_EXPIRED", cert.get('expirystr', 'Unknown'), spiderfoot_plugin.__name__, root_event) | ||
spiderfoot_plugin.notifyListeners(new_event) | ||
return | ||
|
||
if cert.get('expiring'): | ||
new_event = SpiderFootEvent("SSL_CERTIFICATE_EXPIRING", cert.get('expirystr', 'Unknown'), spiderfoot_plugin.__name__, root_event) | ||
spiderfoot_plugin.notifyListeners(new_event) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters