SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
Python attacksurfacecticybersecurityfootprintinghackinginformation-gatheringinformation-securityinfosecintelligence-gatheringosintosint-frameworkosint-reconnaissanceosint-toolpentestingpythonreconsecurity-toolsthreat-intelligencethreatintel
Add matches to sfp_webanalytics
Brendan Coles644899d6cc54
diff --git a/modules/sfp_webanalytics.py b/modules/sfp_webanalytics.pyindex 0fd246e9..64fcb2b4 100644--- a/modules/sfp_webanalytics.py+++ b/modules/sfp_webanalytics.py@@ -1,8 +1,8 @@# -*- coding: utf-8 -*-# --------------------------------------------------------------------------------# Name: sfp_webanalytics-# Purpose: SpiderFoot plug-in for scanning retrieved content by other-# modules (such as sfp_spider) and identifying web analytics IDs.+# Name: sfp_webanalytics+# Purpose: Scans retrieved content by other modules (such as sfp_spider and+# sfp_dnsraw) and retrieves web analytics and tracking IDs.## Author: <[email protected]>#@@ -16,7 +16,7 @@ from hashlib import sha256from sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEventclass sfp_webanalytics(SpiderFootPlugin):- """Web Analytics:Footprint,Investigate:Content Analysis::Identify web analytics IDs in scraped webpages."""+ """Web Analytics:Footprint,Investigate:Content Analysis::Identify web analytics IDs in scraped webpages and DNS TXT records."""opts = {}optdescs = {}@@ -32,7 +32,7 @@ class sfp_webanalytics(SpiderFootPlugin):# What events is this module interested in for inputdef watchedEvents(self):- return ["TARGET_WEB_CONTENT"]+ return ['TARGET_WEB_CONTENT', 'DNS_TEXT']# What events this module producesdef producedEvents(self):@@ -44,50 +44,242 @@ class sfp_webanalytics(SpiderFootPlugin):srcModuleName = event.moduleeventData = event.datasourceData = self.sf.hashstring(eventData)+ parentEvent = event.sourceEventif sourceData in self.results:+ self.sf.debug("Skipping " + eventData + " as already mapped.")return Noneself.results[sourceData] = Trueself.sf.debug("Received event, " + eventName + ", from " + srcModuleName)- # Google Analytics- matches = re.findall(r"\bua\-\d{4,10}\-\d{1,4}\b", eventData, re.IGNORECASE)- for m in matches:- if m.lower().startswith('ua-000000-'):- continue- if m.lower().startswith('ua-123456-'):- continue- if m.lower().startswith('ua-123456789'):- continue-- self.sf.debug("Google Analytics match: " + m)- evt = SpiderFootEvent("WEB_ANALYTICS_ID", "Google Analytics: " + m, self.__name__, event)- self.notifyListeners(evt)-- # Google AdSense- matches = re.findall(r"\b(pub-\d{10,20})\b", eventData, re.IGNORECASE)- for m in matches:- if m.lower().startswith('pub-123456789'):- continue-- self.sf.debug("Google AdSense match: " + m)- evt = SpiderFootEvent("WEB_ANALYTICS_ID", "Google AdSense: " + m, self.__name__, event)- self.notifyListeners(evt)-- # Google Website Verification- matches = re.findall(r'<meta name="google-site-verification" content="([a-z0-9\-\+_=]{43,44})"', eventData, re.IGNORECASE)- for m in matches:- self.sf.debug("Google Site Verification match: " + m)- evt = SpiderFootEvent("WEB_ANALYTICS_ID", "Google Site Verification: " + m, self.__name__, event)- self.notifyListeners(evt)-- matches = re.findall(r'<meta name="verify-v1" content="([a-z0-9\-\+_=]{43,44})"', eventData, re.IGNORECASE)- for m in matches:- self.sf.debug("Google Site Verification match: " + m)- evt = SpiderFootEvent("WEB_ANALYTICS_ID", "Google Site Verification: " + m, self.__name__, event)- self.notifyListeners(evt)+ if eventName == 'TARGET_WEB_CONTENT':+ # Google Analytics+ matches = re.findall(r"\bua\-\d{4,10}\-\d{1,4}\b", eventData, re.IGNORECASE)+ for m in matches:+ if m.lower().startswith('ua-000000-'):+ continue+ if m.lower().startswith('ua-123456-'):+ continue+ if m.lower().startswith('ua-12345678'):+ continue++ self.sf.debug("Google Analytics match: " + m)+ evt = SpiderFootEvent("WEB_ANALYTICS_ID",+ "Google Analytics: " + m,+ self.__name__, parentEvent)+ self.notifyListeners(evt)++ # Google AdSense+ matches = re.findall(r"\b(pub-\d{10,20})\b", eventData, re.IGNORECASE)+ for m in matches:+ if m.lower().startswith('pub-12345678'):+ continue++ self.sf.debug("Google AdSense match: " + m)+ evt = SpiderFootEvent("WEB_ANALYTICS_ID",+ "Google AdSense: " + m,+ self.__name__, parentEvent)+ self.notifyListeners(evt)++ # Google Website Verification+ matches = re.findall(r'<meta name="google-site-verification" content="([a-z0-9\-\+_=]{43,44})"', eventData, re.IGNORECASE)+ for m in matches:+ self.sf.debug("Google Site Verification match: " + m)+ evt = SpiderFootEvent("WEB_ANALYTICS_ID",+ "Google Site Verification: " + m,+ self.__name__, parentEvent)+ self.notifyListeners(evt)++ matches = re.findall(r'<meta name="verify-v1" content="([a-z0-9\-\+_=]{43,44})"', eventData, re.IGNORECASE)+ for m in matches:+ self.sf.debug("Google Site Verification match: " + m)+ evt = SpiderFootEvent("WEB_ANALYTICS_ID",+ "Google Site Verification: " + m,+ self.__name__, parentEvent)+ self.notifyListeners(evt)++ # Quantcast+ if '_qevents.push' in eventData:+ matches = re.findall(r"\bqacct:\"(p-[a-z0-9]+)\"", eventData, re.IGNORECASE)+ for m in matches:+ self.sf.debug("Quantcast match: " + m)+ evt = SpiderFootEvent("WEB_ANALYTICS_ID",+ "Quantcast: " + m,+ self.__name__, parentEvent)+ self.notifyListeners(evt)++ # Ahrefs Site Verification+ matches = re.findall(r'<meta name="ahrefs-site-verification" content="([a-f0-9]{64})"', eventData, re.IGNORECASE)+ for m in matches:+ self.sf.debug("Ahrefs Site Verification match: " + m)+ evt = SpiderFootEvent("WEB_ANALYTICS_ID",+ "Ahrefs Site Verification: " + m,+ self.__name__, parentEvent)+ self.notifyListeners(evt)++ if eventName == 'DNS_TEXT':+ # Google Website Verification+ matches = re.findall(r'google-site-verification=([a-z0-9\-\+_=]{43,44})$', eventData.strip(), re.IGNORECASE)+ for m in matches:+ evt = SpiderFootEvent("WEB_ANALYTICS_ID",+ "Google Site Verification: " + m,+ self.__name__, parentEvent)+ self.notifyListeners(evt)++ # LogMeIn Domain Verification+ # https://support.logmeininc.com/openvoice/help/adding-a-txt-record-to-a-dns-server-ov710011+ matches = re.findall(r'logmein-domain-confirmation ([A-Z0-9]{24})$', eventData.strip(), re.IGNORECASE)+ for m in matches:+ evt = SpiderFootEvent("WEB_ANALYTICS_ID",+ "LogMeIn Domain Verification: " + m,+ self.__name__, parentEvent)+ self.notifyListeners(evt)++ matches = re.findall(r'logmein-verification-code=([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})$', eventData.strip(), re.IGNORECASE)+ for m in matches:+ evt = SpiderFootEvent("WEB_ANALYTICS_ID",+ "LogMeIn Domain Verification: " + m,+ self.__name__, parentEvent)+ self.notifyListeners(evt)++ # DocuSign Domain Verification+ matches = re.findall(r'docusign=([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})$', eventData.strip(), re.IGNORECASE)+ for m in matches:+ evt = SpiderFootEvent("WEB_ANALYTICS_ID",+ "DocuSign Domain Verification: " + m,+ self.__name__, parentEvent)+ self.notifyListeners(evt)++ # GlobalSign Site Verification+ matches = re.findall(r'globalsign-domain-verification=([a-z0-9\-\+_=]{42,44})$', eventData.strip(), re.IGNORECASE)+ for m in matches:+ evt = SpiderFootEvent("WEB_ANALYTICS_ID",+ "GlobalSign Site Verification: " + m,+ self.__name__, parentEvent)+ self.notifyListeners(evt)++ # Atlassian Domain Verification+ matches = re.findall(r'atlassian-domain-verification=([a-z0-9\-\+\/_=]{64})$', eventData.strip(), re.IGNORECASE)+ for m in matches:+ evt = SpiderFootEvent("WEB_ANALYTICS_ID",+ "Atlassian Domain Verification: " + m,+ self.__name__, parentEvent)+ self.notifyListeners(evt)++ # Adobe IDP Site Verification+ matches = re.findall(r'adobe-idp-site-verification=([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})$', eventData.strip(), re.IGNORECASE)+ for m in matches:+ evt = SpiderFootEvent("WEB_ANALYTICS_ID",+ "Adobe IDP Site Verification: " + m,+ self.__name__, parentEvent)+ self.notifyListeners(evt)++ matches = re.findall(r'adobe-idp-site-verification=([a-f0-9]{64})$', eventData.strip(), re.IGNORECASE)+ for m in matches:+ evt = SpiderFootEvent("WEB_ANALYTICS_ID",+ "Adobe IDP Site Verification: " + m,+ self.__name__, parentEvent)+ self.notifyListeners(evt)++ # Adobe Domain Verification+ matches = re.findall(r'adobe-sign-verification=([a-f0-9]{32})$', eventData.strip(), re.IGNORECASE)+ for m in matches:+ evt = SpiderFootEvent("WEB_ANALYTICS_ID",+ "Adobe Domain Verification: " + m,+ self.__name__, parentEvent)+ self.notifyListeners(evt)++ # Aliyun Site Verification+ matches = re.findall(r'aliyun-site-verification=([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})$', eventData.strip(), re.IGNORECASE)+ for m in matches:+ evt = SpiderFootEvent("WEB_ANALYTICS_ID",+ "Aliyun Site Verification: " + m,+ self.__name__, parentEvent)+ self.notifyListeners(evt)++ # Facebook Domain Verification+ matches = re.findall(r'facebook-domain-verification=([a-z0-9]{30})$', eventData.strip(), re.IGNORECASE)+ for m in matches:+ evt = SpiderFootEvent("WEB_ANALYTICS_ID",+ "Facebook Domain Verification: " + m,+ self.__name__, parentEvent)+ self.notifyListeners(evt)++ # Citrix Domain Verification+ matches = re.findall(r'citrix-verification-code=([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})$', eventData.strip(), re.IGNORECASE)+ for m in matches:+ evt = SpiderFootEvent("WEB_ANALYTICS_ID",+ "Citrix Domain Verification: " + m,+ self.__name__, parentEvent)+ self.notifyListeners(evt)++ # Dropbox Domain Verification+ matches = re.findall(r'dropbox-domain-verification=([a-z0-9]{12})$', eventData.strip(), re.IGNORECASE)+ for m in matches:+ evt = SpiderFootEvent("WEB_ANALYTICS_ID",+ "Dropbox Domain Verification: " + m,+ self.__name__, parentEvent)+ self.notifyListeners(evt)++ # Detectify Domain Verification+ matches = re.findall(r'detectify-verification=([a-f0-9]{32})$', eventData.strip(), re.IGNORECASE)+ for m in matches:+ evt = SpiderFootEvent("WEB_ANALYTICS_ID",+ "Detectify Domain Verification: " + m,+ self.__name__, parentEvent)+ self.notifyListeners(evt)++ # Drift Domain Verification+ matches = re.findall(r'detectify-verification=([a-f0-9]{64})$', eventData.strip(), re.IGNORECASE)+ for m in matches:+ evt = SpiderFootEvent("WEB_ANALYTICS_ID",+ "Drift Domain Verification: " + m,+ self.__name__, parentEvent)+ self.notifyListeners(evt)++ # Ahrefs Site Verification+ matches = re.findall(r'ahrefs-site-verification_([a-f0-9]{64})$', eventData.strip(), re.IGNORECASE)+ for m in matches:+ evt = SpiderFootEvent("WEB_ANALYTICS_ID",+ "Ahrefs Site Verification: " + m,+ self.__name__, parentEvent)+ self.notifyListeners(evt)++ # Statuspage.io Domain Verification+ # https://help.statuspage.io/help/domain-ownership+ matches = re.findall(r'status-page-domain-verification=([a-z0-9]{12})$', eventData.strip(), re.IGNORECASE)+ for m in matches:+ evt = SpiderFootEvent("WEB_ANALYTICS_ID",+ "Statuspage Domain Verification: " + m,+ self.__name__, parentEvent)+ self.notifyListeners(evt)++ # Zoom.us Domain Verification+ # https://support.zoom.us/hc/en-us/articles/203395207-What-is-Managed-Domain-+ matches = re.findall(r'ZOOM_verify_([a-z0-9\-\+\/_=]{22})$', eventData.strip(), re.IGNORECASE)+ for m in matches:+ evt = SpiderFootEvent("WEB_ANALYTICS_ID",+ "Zoom.us Domain Verification: " + m,+ self.__name__, parentEvent)+ self.notifyListeners(evt)++ # Mail.ru Domain Verification+ matches = re.findall(r'mailru-verification: ([a-z0-9]{16})$', eventData.strip(), re.IGNORECASE)+ for m in matches:+ evt = SpiderFootEvent("WEB_ANALYTICS_ID",+ "Mail.ru Domain Verification: " + m,+ self.__name__, parentEvent)+ self.notifyListeners(evt)++ # Yandex Domain Verification+ matches = re.findall(r'yandex-verification: ([a-z0-9]{16})$', eventData.strip(), re.IGNORECASE)+ for m in matches:+ evt = SpiderFootEvent("WEB_ANALYTICS_ID",+ "Yandex Domain Verification: " + m,+ self.__name__, parentEvent)+ self.notifyListeners(evt)return None