SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
Python attacksurfacecticybersecurityfootprintinghackinginformation-gatheringinformation-securityinfosecintelligence-gatheringosintosint-frameworkosint-reconnaissanceosint-toolpentestingpythonreconsecurity-toolsthreat-intelligencethreatintel
Add sfp_myspace module
Brendan Coles3fca5efc5f2b
diff --git a/modules/sfp_myspace.py b/modules/sfp_myspace.pynew file mode 100644index 00000000..484bd821--- /dev/null+++ b/modules/sfp_myspace.py@@ -0,0 +1,103 @@+#-------------------------------------------------------------------------------+# Name: sfp_myspace+# Purpose: Query MySpace for username and location information.+#+# Author: Brendan Coles <[email protected]>+#+# Created: 2018-10-07+# Copyright: (c) Brendan Coles 2018+# Licence: GPL+#-------------------------------------------------------------------------------++import re+from sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEvent++class sfp_myspace(SpiderFootPlugin):+ """MySpace:Footprint,Investigate,Passive:Social Media::Gather username and location from MySpace.com profiles."""++ # Default options+ opts = {+ }++ # Option descriptions+ optdescs = {+ }++ def setup(self, sfc, userOpts=dict()):+ self.sf = sfc+ self.__dataSource__ = "MySpace.com"+ self.results = list()++ for opt in userOpts.keys():+ self.opts[opt] = userOpts[opt]++ # What events is this module interested in for input+ def watchedEvents(self):+ return [ "EMAILADDR", "SOCIAL_MEDIA" ]++ # What events this module produces+ def producedEvents(self):+ return [ "SOCIAL_MEDIA", "GEOINFO" ]++ # Handle events sent to this module+ def handleEvent(self, event):+ eventName = event.eventType+ srcModuleName = event.module+ eventData = event.data++ if eventData in self.results:+ return None+ else:+ self.results.append(eventData)++ self.sf.debug("Received event, " + eventName + ", from " + srcModuleName)++ # Search by email address+ if eventName == "EMAILADDR":+ email = eventData+ res = self.sf.fetchUrl("https://myspace.com/search/people?q=" + email, timeout=self.opts['_fetchtimeout'], useragent=self.opts['_useragent'])++ if res['content'] is None:+ return None++ # The first result is the closest match, but whether it's an exact match is unknown.+ # As such, we check for email address as name, at the risk of missed results.+ profiles = re.findall(r'<a href="/([a-zA-Z0-9_]+)">' + email.lower() + '</a></h6>', res['content'].lower())++ if not profiles:+ return None++ name = profiles[0]++ e = SpiderFootEvent("SOCIAL_MEDIA", "MySpace: " + name, self.__name__, event)+ self.notifyListeners(e)++ # Retrieve location from MySpace profile+ if eventName == "SOCIAL_MEDIA":+ network = eventData.split(": ")[0]+ name = eventData.split(": ")[1]++ if network != "MySpace":+ self.sf.debug("Skipping social network profile, " + name + ", as not a MySpace profile")+ return None++ res = self.sf.fetchUrl("https://myspace.com/" + name, timeout=self.opts['_fetchtimeout'], useragent=self.opts['_useragent'])++ if res['content'] is None:+ return None++ data = re.findall(r'<div class="location_[^"]+" data-display-text="(.+?)"', res['content'])++ if not data:+ return None++ location = data[0]++ if len(location) < 5 or len(location) > 100:+ self.sf.debug("Skipping likely invalid location.")+ return None++ e = SpiderFootEvent("GEOINFO", location, self.__name__, event)+ self.notifyListeners(e)++# End of sfp_myspace classdiff --git a/modules/sfp_social.py b/modules/sfp_social.pyindex 3a9b2f2f..5852099b 100644--- a/modules/sfp_social.py+++ b/modules/sfp_social.py@@ -19,6 +19,7 @@ regexps = dict({"Github": list(['.*github.com/([a-zA-Z0-9_]+)\/']),"Google+": list(['.*plus.google.com/([0-9]+$)']),"Facebook": list(['.*facebook.com/([a-zA-Z0-9_]+$)']),+ "MySpace": list(['https?://myspace.com/([a-zA-Z0-9_\.]+$)']),"YouTube": list(['.*youtube.com/([a-zA-Z0-9_]+$)']),"Twitter": list(['.*twitter.com/([a-zA-Z0-9_]{1,15}$)','.*twitter.com/#!/([a-zA-Z0-9_]{1,15}$)'