Skip to content

SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.

Bug fixes

smicallef0d357b42250c
diff --git a/modules/sfp_crt.py b/modules/sfp_crt.py
index b5a31b11..efc4d5c7 100644
--- a/modules/sfp_crt.py
+++ b/modules/sfp_crt.py
@@ -12,7 +12,7 @@
# -------------------------------------------------------------------------------
import json
-import urllib.request, urllib.parse, urllib.error
+import urllib.parse
from sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEvent
@@ -68,7 +68,7 @@ class sfp_crt(SpiderFootPlugin):
}
res = self.sf.fetchUrl('https://crt.sh/?' + urllib.parse.urlencode(params),
- timeout=15,
+ timeout=self.opts['_fetchtimeout'],
useragent=self.opts['_useragent'])
if res['content'] is None:
@@ -91,15 +91,19 @@ class sfp_crt(SpiderFootPlugin):
domains = list()
for cert_info in data:
- cert_id = cert_info.get('min_cert_id')
+ cert_id = cert_info.get('id')
if cert_id:
cert_ids.append(cert_id)
domain = cert_info.get('name_value')
-
- if domain and domain != eventData:
- domains.append(domain.replace("*.", ""))
+ if '\n' in domain:
+ doms = domain.split("\n")
+ for d in doms:
+ domains.append(d.replace("*.", ""))
+ else:
+ if domain and domain != eventData:
+ domains.append(domain.replace("*.", ""))
if self.opts['verify'] and len(domains) > 0:
self.sf.info("Resolving " + str(len(set(domains))) + " domains ...")
@@ -137,7 +141,7 @@ class sfp_crt(SpiderFootPlugin):
}
res = self.sf.fetchUrl('https://crt.sh/?' + urllib.parse.urlencode(params),
- timeout=15,
+ timeout=self.opts['_fetchtimeout'],
useragent=self.opts['_useragent'])
try:
diff --git a/modules/sfp_names.py b/modules/sfp_names.py
index a72c7621..76894b40 100644
--- a/modules/sfp_names.py
+++ b/modules/sfp_names.py
@@ -69,9 +69,10 @@ class sfp_names(SpiderFootPlugin):
# or CSS, in which case optionally ignore it.
if eventName == "TARGET_WEB_CONTENT":
url = event.actualSource
- if self.opts['filterjscss'] and (".js" in url or ".css" in url):
- self.sf.debug("Ignoring web content from CSS/JS.")
- return None
+ if url is not None:
+ if self.opts['filterjscss'] and (".js" in url or ".css" in url):
+ self.sf.debug("Ignoring web content from CSS/JS.")
+ return None
if eventName == "EMAILADDR" and self.opts['emailtoname']:
if "." in eventData.split("@")[0]:
diff --git a/modules/sfp_pgp.py b/modules/sfp_pgp.py
index c6237561..ec62c6cd 100644
--- a/modules/sfp_pgp.py
+++ b/modules/sfp_pgp.py
@@ -13,10 +13,8 @@
# -------------------------------------------------------------------------------
import re
-
from sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEvent
-
class sfp_pgp(SpiderFootPlugin):
"""PGP Key Look-up:Footprint,Investigate,Passive:Public Registries::Look up e-mail addresses in PGP public key servers."""
@@ -76,12 +74,12 @@ class sfp_pgp(SpiderFootPlugin):
timeout=self.opts['_fetchtimeout'],
useragent=self.opts['_useragent'])
- if res['content'] is None:
+ if res['content'] is None or res['code'] == "503":
res = self.sf.fetchUrl(self.opts['keyserver_search2'] + eventData,
timeout=self.opts['_fetchtimeout'],
useragent=self.opts['_useragent'])
- if res['content'] is not None:
+ if res['content'] is not None and res['code'] != "503":
emails = self.sf.parseEmails(res['content'])
for email in emails:
evttype = "EMAILADDR"
@@ -99,12 +97,12 @@ class sfp_pgp(SpiderFootPlugin):
timeout=self.opts['_fetchtimeout'],
useragent=self.opts['_useragent'])
- if res['content'] is None:
+ if res['content'] is None or res['code'] == "503":
res = self.sf.fetchUrl(self.opts['keyserver_fetch2'] + eventData,
timeout=self.opts['_fetchtimeout'],
useragent=self.opts['_useragent'])
- if res['content'] is not None:
+ if res['content'] is not None and res['code'] != "503":
pat = re.compile("(-----BEGIN.*END.*BLOCK-----)", re.MULTILINE | re.DOTALL)
matches = re.findall(pat, res['content'])
for match in matches:
diff --git a/modules/sfp_sslcert.py b/modules/sfp_sslcert.py
index 276c2924..4ada7bcf 100644
--- a/modules/sfp_sslcert.py
+++ b/modules/sfp_sslcert.py
@@ -77,12 +77,16 @@ class sfp_sslcert(SpiderFootPlugin):
if not eventData.lower().startswith("https://") and not self.opts['tryhttp']:
return None
- # Handle URLs containing port numbers
- u = urlparse(eventData)
- port = 443
- if u.port:
- port = u.port
- fqdn = self.sf.urlFQDN(eventData.lower())
+ try:
+ # Handle URLs containing port numbers
+ u = urlparse(eventData)
+ port = 443
+ if u.port:
+ port = u.port
+ fqdn = self.sf.urlFQDN(eventData.lower())
+ except BaseException as e:
+ self.sf.debug("Couldn't parse URL: " + eventData)
+ return None
else:
fqdn = eventData
port = 443
diff --git a/modules/sfp_ssltools.py b/modules/sfp_ssltools.py
index 8a09231e..69477f03 100644
--- a/modules/sfp_ssltools.py
+++ b/modules/sfp_ssltools.py
@@ -173,7 +173,7 @@ class sfp_ssltools(SpiderFootPlugin):
return None
if not cert.get('text'):
- self.sf.info("Failed to parse the SSL cert for " + fqdn)
+ self.sf.info("Failed to parse the SSL cert for " + eventData)
return None
evt = SpiderFootEvent('SSL_CERTIFICATE_RAW', cert['text'], self.__name__, event)
diff --git a/modules/sfp_wikipediaedits.py b/modules/sfp_wikipediaedits.py
index a945d717..d10db883 100644
--- a/modules/sfp_wikipediaedits.py
+++ b/modules/sfp_wikipediaedits.py
@@ -12,7 +12,6 @@
import datetime
import re
-
from html.parser import HTMLParser
from sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEvent
@@ -69,6 +68,9 @@ class sfp_wikipediaedits(SpiderFootPlugin):
links = list()
try:
parser = HTMLParser()
+ if not res['content']:
+ return None
+
for line in res['content'].split("\n"):
matches = re.findall("<link>(.*?)</link>", line, re.IGNORECASE)
for m in matches:
diff --git a/requirements.txt b/requirements.txt
index 51951ad8..2dd6e438 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -21,3 +21,4 @@ pyOpenSSL>=16.2.0
python-docx>=0.8.10
python-pptx>=0.6.18
networkx==2.3
+cryptography>=2.5
diff --git a/sflib.py b/sflib.py
index 4423e954..8f2839b1 100644
--- a/sflib.py
+++ b/sflib.py
@@ -776,10 +776,14 @@ class SpiderFoot:
# Simple way to verify IPv4 addresses.
def validIP(self, address):
+ if not address:
+ return False
return netaddr.valid_ipv4(address)
# Simple way to verify IPv6 addresses.
def validIP6(self, address):
+ if not address:
+ return False
return netaddr.valid_ipv6(address)
# Simple way to verify netblock.