SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
Python attacksurfacecticybersecurityfootprintinghackinginformation-gatheringinformation-securityinfosecintelligence-gatheringosintosint-frameworkosint-reconnaissanceosint-toolpentestingpythonreconsecurity-toolsthreat-intelligencethreatintel
Reduced false positives.
Steve47cd21334743
diff --git a/modules/sfp_binstring.py b/modules/sfp_binstring.pyindex cdb7e397..fcc6d603 100644--- a/modules/sfp_binstring.py+++ b/modules/sfp_binstring.py@@ -32,11 +32,11 @@ class sfp_binstring(SpiderFootPlugin):# Option descriptionsoptdescs = {'minwordsize': "Upon finding a string in a binary, ensure it is at least this length. Helps weed out false positives.",- 'usedict': "Use the English dictionary to further reduce false positives - any string found must contain a word from the dictionary (can be very slow, especially for larger files).",+ 'usedict': "Use the dictionary to further reduce false positives - any string found must contain a word from the dictionary (can be very slow, especially for larger files).",'fileexts': "File types to fetch and analyse.",- 'maxfilesize': "Maximum file size to download for analysis.",- 'maxwords': "Stop reporting strings after this many are found.",- 'filterchars': "Ignore lines with these characters."+ 'maxfilesize': "Maximum file size in bytes to download for analysis.",+ 'maxwords': "Stop reporting strings from a single binary after this many are found.",+ 'filterchars': "Ignore strings with these characters, as they may just be garbage ASCII."}results = list()diff --git a/modules/sfp_pwned.py b/modules/sfp_pwned.pyindex 2c8e2658..24fa4ae8 100644--- a/modules/sfp_pwned.py+++ b/modules/sfp_pwned.py@@ -1,6 +1,6 @@#-------------------------------------------------------------------------------# Name: sfp_pwned-# Purpose: Query haveibeenpwned.com to see if an account has been hacked.+# Purpose: Query haveibeenpwned.com to see if an e-mail account has been hacked.## Author: Steve Micallef <[email protected]>#@@ -15,16 +15,14 @@ import timefrom sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEventclass sfp_pwned(SpiderFootPlugin):- """Pwned Password:Footprint,Investigate,Passive:Search Engines:errorprone:Check Have I Been Pwned? for hacked accounts identified."""+ """Pwned Password:Footprint,Investigate,Passive:Search Engines:errorprone:Check Have I Been Pwned? for hacked e-mail addresses identified."""# Default optionsopts = {- "lookupusernames": True}# Option descriptionsoptdescs = {- "lookupusernames": "Also look up usernames, not just e-mail addresses. More prone to false positives for common names."}# Be sure to completely clear any class variables in setup()@@ -44,40 +42,31 @@ class sfp_pwned(SpiderFootPlugin):# What events is this module interested in for inputdef watchedEvents(self):- ret = ["EMAILADDR"]-- if self.opts['lookupusernames']:- ret.extend(["ACCOUNT_EXTERNAL_USER_SHARED", "ACCOUNT_EXTERNAL_OWNED"])-- return ret+ return ["EMAILADDR"]# What events this module producesdef producedEvents(self):- ret = ["EMAILADDR_COMPROMISED"]-- if self.opts['lookupusernames']:- ret.extend(["ACCOUNT_EXTERNAL_USER_SHARED_COMPROMISED",- "ACCOUNT_EXTERNAL_OWNED_COMPROMISED"])-- return ret+ return ["EMAILADDR_COMPROMISED"]def query(self, qry):ret = None-url = "https://haveibeenpwned.com/api/v2/breachedaccount/" + qryhdrs = { "Accept": "application/vnd.haveibeenpwned.v2+json" }+ retry = 0- # https://haveibeenpwned.com/API/v2#RateLimiting- time.sleep(1.5)- res = self.sf.fetchUrl(url, timeout=self.opts['_fetchtimeout'],- useragent="SpiderFoot", headers=hdrs)+ while retry < 2:+ # https://haveibeenpwned.com/API/v2#RateLimiting+ time.sleep(1.5)+ res = self.sf.fetchUrl(url, timeout=self.opts['_fetchtimeout'],+ useragent="SpiderFoot", headers=hdrs)- if res['code'] in [ 404, "404" ]:- return None+ if res['code'] in [ 404, "404" ]:+ return None- if res['code'] in [ 429, "429" ]:- # Back off a little further- time.sleep(2)+ if res['code'] in [ 429, "429" ]:+ # Back off a little further+ time.sleep(2)+ retry += 1try:ret = json.loads(res['content'])@@ -91,15 +80,12 @@ class sfp_pwned(SpiderFootPlugin):def handleEvent(self, event):eventName = event.eventTypesrcModuleName = event.module- if "ACCOUNT" in eventName:- eventData = event.data.split(" ")[0]- else:- eventData = event.data+ eventData = event.dataself.sf.debug("Received event, " + eventName + ", from " + srcModuleName)# Don't look up stuff twice- if self.results.has_key(eventData):+ if eventData in self.results:self.sf.debug("Skipping " + eventData + " as already mapped.")return Noneelse:@@ -114,7 +100,7 @@ class sfp_pwned(SpiderFootPlugin):evt = eventName + "_COMPROMISED"# Notify other modules of what you've founde = SpiderFootEvent(evt, eventData + " [" + site + "]",- self.__name__, event)+ self.__name__, event)self.notifyListeners(e)# End of sfp_pwned class