SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
Python attacksurfacecticybersecurityfootprintinghackinginformation-gatheringinformation-securityinfosecintelligence-gatheringosintosint-frameworkosint-reconnaissanceosint-toolpentestingpythonreconsecurity-toolsthreat-intelligencethreatintel
Query phonebook API endpoint from IntelX.
smicallef12e7075b860c
diff --git a/modules/sfp_intelx.py b/modules/sfp_intelx.pyindex 2d1cb64a..980fa3cf 100644--- a/modules/sfp_intelx.py+++ b/modules/sfp_intelx.py@@ -70,9 +70,11 @@ class sfp_intelx(SpiderFootPlugin):# What events this module producesdef producedEvents(self):- return ["LEAKSITE_URL", "DARKNET_MENTION_URL"]+ return ["LEAKSITE_URL", "DARKNET_MENTION_URL",+ "INTERNET_NAME", "DOMAIN_NAME",+ "EMAILADDR", "EMAILADDR_GENERIC"]- def query(self, qry):+ def query(self, qry, qtype):ret = Noneheaders = {@@ -91,10 +93,10 @@ class sfp_intelx(SpiderFootPlugin):"sort": 4,"media": 0,"terminate": []- }+ }- url = 'https://' + self.opts['base_url'] + '/intelligent/search'- res = self.sf.fetchUrl(url, postData=json.dumps(payload),+ url = 'https://' + self.opts['base_url'] + '/' + qtype + '/search'+ res = self.sf.fetchUrl(url, postData=json.dumps(payload),headers=headers, timeout=self.opts['_fetchtimeout'])if res['content'] is None:@@ -104,7 +106,7 @@ class sfp_intelx(SpiderFootPlugin):try:ret = json.loads(res['content'])except Exception as e:- self.sf.error("Error processing JSON response from IntelligenceX.", False)+ self.sf.error("Error processing JSON response from IntelligenceX: " + str(e), False)self.errorState = Truereturn None@@ -126,7 +128,7 @@ class sfp_intelx(SpiderFootPlugin):try:ret = json.loads(res['content'])except Exception as e:- self.sf.error("Error processing JSON response from IntelligenceX.", False)+ self.sf.error("Error processing JSON response from IntelligenceX: " + str(e), False)return Nonestatus = ret['status']@@ -138,7 +140,7 @@ class sfp_intelx(SpiderFootPlugin):return rettime.sleep(1)-+self.sf.debug("No results found.")return None@@ -171,16 +173,16 @@ class sfp_intelx(SpiderFootPlugin):if eventName == 'CO_HOSTED_SITE' and not self.opts['checkcohosts']:return None- info = self.query(eventData)+ info = self.query(eventData, "intelligent")if info is None:return None- self.sf.info("Found IntelligenceX URL data for " + eventData)+ self.sf.info("Found IntelligenceX leak data for " + eventData)agelimit = int(time.time() * 1000) - (86400000 * self.opts['maxage'])for rec in info.get("records", dict()):try:last_seen = int(datetime.datetime.strptime(rec['added'].split(".")[0], '%Y-%m-%dT%H:%M:%S').strftime('%s')) * 1000- if last_seen < agelimit:+ if last_seen < agelimit:self.sf.debug("Record found but too old, skipping.")continue@@ -199,9 +201,50 @@ class sfp_intelx(SpiderFootPlugin):except BaseException as e:self.sf.error("Error processing content from IntelX: " + str(e), False)continue++ # Notify other modules of what you've found+ e = SpiderFootEvent(evt, val, self.__name__, event)+ self.notifyListeners(e)++ if "public.intelx.io" in self.opts['base_url'] or eventName != "INTERNET_NAME":+ return None++ info = self.query(eventData, "phonebook")+ if info is None:+ return None++ self.sf.info("Found IntelligenceX host and email data for " + eventData)+ for rec in info.get("selectors", dict()):+ try:+ val = rec['selectorvalueh']+ evt = None+ if rec['selectortype'] == 1: #Email+ evt = "EMAILADDR"+ if val.split("@")[0] in self.opts['_genericusers'].split(","):+ evt = "EMAILADDR_GENERIC"+ if rec['selectortype'] == 2: #Domain+ evt = "INTERNET_NAME"+ if val == eventData:+ continue+ if rec['selectortype'] == 3: #URL+ evt = "LINKED_URL_INTERNAL"++ if not val or not evt:+ self.sf.debug("Unexpected record, skipping.")+ continue+ except BaseException as e:+ self.sf.error("Error processing content from IntelX: " + str(e), False)+ continue# Notify other modules of what you've founde = SpiderFootEvent(evt, val, self.__name__, event)self.notifyListeners(e)+ if evt == "INTERNET_NAME" and self.sf.isDomain(val, self.opts['_internettlds']):+ e = SpiderFootEvent("DOMAIN_NAME", val, self.__name__, event)+ self.notifyListeners(e)++++# End of sfp_intelx class