SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
Python attacksurfacecticybersecurityfootprintinghackinginformation-gatheringinformation-securityinfosecintelligence-gatheringosintosint-frameworkosint-reconnaissanceosint-toolpentestingpythonreconsecurity-toolsthreat-intelligencethreatintel
Internal data processing bugs fixed.
smicallefe565e996fea5
diff --git a/modules/sfp__stor_db.py b/modules/sfp__stor_db.pyindex e9a033b0..d182b617 100644--- a/modules/sfp__stor_db.py+++ b/modules/sfp__stor_db.py@@ -52,16 +52,6 @@ class sfp__stor_db(SpiderFootPlugin):# Handle events sent to this moduledef handleEvent(self, sfEvent):-- # If we get passed a dict or list, convert it to a string first, as- # those types do not have a unicode converter.- if type(sfEvent.data) not in [unicode, str]:- sfEvent.data = str(sfEvent.data)-- # Convert to a string in case we get passed integers or other things- if type(sfEvent.data) is not unicode:- sfEvent.data = unicode(sfEvent.data, 'utf-8', errors='replace')-if self.opts['maxstorage'] != 0:if len(sfEvent.data) > self.opts['maxstorage']:sfdb.scanEventStore(self.opts['__guid__'], sfEvent, self.opts['maxstorage'])diff --git a/modules/sfp_websvr.py b/modules/sfp_websvr.pyindex b9ab6ff1..2e56fa5b 100644--- a/modules/sfp_websvr.py+++ b/modules/sfp_websvr.py@@ -59,10 +59,6 @@ class sfp_websvr(SpiderFootPlugin):sf.debug("Not collecting web server information for external sites.")return None- # Protect myself from bad data- if eventData is not dict():- return None-# Could apply some smarts here, for instance looking for certain# banners and therefore classifying them further (type and version,# possibly OS. This could also trigger additional tests, such as 404sdiff --git a/sfdb.py b/sfdb.pyindex 3dd6a948..37a01900 100644--- a/sfdb.py+++ b/sfdb.py@@ -431,11 +431,23 @@ class SpiderFootDb:# - sourceEventHash: hash of the event that triggered this event# And getHash() will return the event hash.def scanEventStore(self, instanceId, sfEvent, truncateSize=0):- if truncateSize > 0:- storeData = sfEvent.data[0:truncateSize]++ if type(sfEvent.data) is not unicode:+ # If sfEvent.data is a dict or list, convert it to a string first, as+ # those types do not have a unicode converter.+ if type(sfEvent.data) is str:+ storeData = unicode(sfEvent.data, 'utf-8', errors='replace')+ else:+ try:+ storeData = unicode(str(sfEvent.data), 'utf-8', errors='replace')+ except BaseException as e:+ sf.fatal("Unhandled type detected: " + str(type(sfEvent.data)))else:storeData = sfEvent.data+ if truncateSize > 0:+ storeData = storeData[0:truncateSize]+qry = "INSERT INTO tbl_scan_results \(scan_instance_id, hash, type, generated, confidence, \visibility, risk, module, data, source_event_hash) \diff --git a/sflib.py b/sflib.pyindex ef195484..129f81a4 100644--- a/sflib.py+++ b/sflib.py@@ -73,7 +73,6 @@ class SpiderFoot:print '[Fatal] ' + errorelse:self._dblog("FATAL", error)- raise BaseException("Fatal Error Encountered: " + error)exit(-1)def status(self, message):@@ -593,6 +592,7 @@ class SpiderFootEvent(object):data = NonesourceEvent = NonesourceEventHash = None+ __id = Nonedef __init__(self, eventType, data, module, sourceEvent=None,confidence=100, visibility=100, risk=0):@@ -612,18 +612,20 @@ class SpiderFootEvent(object):else:self.sourceEventHash = "ROOT"+ # Handle lists, dicts+ #if type(self.data) not in [str, unicode]:+ # self.__id = unicode(self.eventType + str(self.data) + str(self.generated) + self.module, 'utf-8', errors='replace')+ #else:+ # self.__id = self.eventType + self.data + str(self.generated) + self.module+ self.__id = self.eventType + str(self.generated) + self.module + \+ str(random.randint(0, 99999999))+# Unique hash of this eventdef getHash(self):if self.eventType == "INITIAL_TARGET":return "ROOT"- # Handle lists and dicts- if type(self.data) not in [str, unicode]:- idString = unicode(self.eventType + str(self.data) + str(self.generated) + self.module, 'utf-8', errors='replace')- else:- idString = self.eventType + self.data + str(self.generated) + self.module-- digestStr = idString.encode('raw_unicode_escape')+ digestStr = self.__id.encode('raw_unicode_escape')return hashlib.sha256(digestStr).hexdigest()# Update variables as new information becomes available