Skip to content

SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.

Google map search.

Stevec3d56e9e2670
diff --git a/modules/sfp_googlemaps.py b/modules/sfp_googlemaps.py
new file mode 100644
index 00000000..e6d2d588
--- /dev/null
+++ b/modules/sfp_googlemaps.py
@@ -0,0 +1,90 @@
+# -*- coding: utf-8 -*-
+# -------------------------------------------------------------------------------
+# Name: sfp_googlemaps
+# Purpose: SpiderFoot plug-in to identify historical certificates for a domain
+# from googlemaps.sh, and from this identify hostnames.
+#
+# Author: Steve Micallef <[email protected]>
+#
+# Created: 18/03/2017
+# Copyright: (c) Steve Micallef 2017
+# Licence: GPL
+# -------------------------------------------------------------------------------
+
+import json
+from sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEvent
+
+
+class sfp_googlemaps(SpiderFootPlugin):
+ """Google Maps:Footprint,Investigate,Passive:Search Engines::Identifies potential physical addresses and latitude/longitude coordinates."""
+
+ # Default options
+ opts = {}
+ results = dict()
+
+ def setup(self, sfc, userOpts=dict()):
+ self.sf = sfc
+ self.results = dict()
+
+ for opt in userOpts.keys():
+ self.opts[opt] = userOpts[opt]
+
+ # What events is this module interested in for input
+ def watchedEvents(self):
+ return ['DOMAIN_NAME', 'PHYSICAL_ADDRESS']
+
+ # What events this module produces
+ # This is to support the end user in selecting modules based on events
+ # produced.
+ def producedEvents(self):
+ return ["PHYSICAL_ADDRESS", "PHYSICAL_COORDINATES"]
+
+ # Handle events sent to this module
+ def handleEvent(self, event):
+ eventName = event.eventType
+ srcModuleName = event.module
+ eventData = event.data
+
+ self.sf.debug("Received event, " + eventName + ", from " + srcModuleName)
+
+ # Don't look up stuff twice
+ if eventData in self.results:
+ self.sf.debug("Skipping " + eventData + " as already mapped.")
+ return None
+ else:
+ self.results[eventData] = True
+
+ res = self.sf.fetchUrl("https://maps.googleapis.com/maps/api/geocode/json?address=" + \
+ eventData, timeout=self.opts['_fetchtimeout'],
+ useragent=self.opts['_useragent'])
+ if res['content'] is None:
+ self.sf.info("No location info found for " + eventData)
+ return None
+
+ evt = SpiderFootEvent("SEARCH_ENGINE_WEB_CONTENT", res['content'],
+ self.__name__, event)
+ self.notifyListeners(evt)
+
+ try:
+ data = json.loads(res['content'])['results'][0]
+
+ if eventName in ["PHYSICAL_ADDRESS", "DOMAIN_NAME"] and \
+ srcModuleName != "sfp_googlemaps":
+ if 'geometry' in data:
+ lat = str(data['geometry']['location']['lat'])
+ lng = str(data['geometry']['location']['lng'])
+ evt = SpiderFootEvent("PHYSICAL_COORDINATES", lat + "," + lng,
+ self.__name__, event)
+ self.notifyListeners(evt)
+
+ if 'formatted_address' in data:
+ evt = SpiderFootEvent("PHYSICAL_ADDRESS", data['formatted_address'],
+ self.__name__, event)
+ self.notifyListeners(evt)
+ except Exception as e:
+ self.sf.debug("Error processing JSON response: " + str(e))
+ return None
+
+ return None
+
+# End of sfp_googlemaps class
diff --git a/modules/sfp_googlesearch.py b/modules/sfp_googlesearch.py
index 8712a2fc..0ba51125 100644
--- a/modules/sfp_googlesearch.py
+++ b/modules/sfp_googlesearch.py
@@ -14,7 +14,7 @@ from sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEvent
class sfp_googlesearch(SpiderFootPlugin):
- """Google:Footprint,Investigate,Passive:Search Engines:errorprone:Some light Google scraping to identify sub-domains and links."""
+ """Google Search:Footprint,Investigate,Passive:Search Engines:errorprone:Some light Google scraping to identify sub-domains and links."""
# Default options
opts = {
diff --git a/sfdb.py b/sfdb.py
index 4c222367..ab79ec79 100644
--- a/sfdb.py
+++ b/sfdb.py
@@ -152,6 +152,8 @@ class SpiderFootDb:
"INSERT INTO tbl_event_types (event, event_descr, event_raw, event_type) VALUES ('LEAKSITE_URL', 'Leak Site URL', 0, 'ENTITY')",
"INSERT INTO tbl_event_types (event, event_descr, event_raw, event_type) VALUES ('LEAKSITE_CONTENT', 'Leak Site Content', 1, 'DATA')",
"INSERT INTO tbl_event_types (event, event_descr, event_raw, event_type) VALUES ('PHONE_NUMBER', 'Phone Number', 0, 'ENTITY')",
+ "INSERT INTO tbl_event_types (event, event_descr, event_raw, event_type) VALUES ('PHYSICAL_ADDRESS', 'Physical Address', 0, 'ENTITY')",
+ "INSERT INTO tbl_event_types (event, event_descr, event_raw, event_type) VALUES ('PHYSICAL_COORDINATES', 'Physical Coordinates', 0, 'ENTITY')",
"INSERT INTO tbl_event_types (event, event_descr, event_raw, event_type) VALUES ('PGP_KEY', 'PGP Public Key', 0, 'DATA')",
"INSERT INTO tbl_event_types (event, event_descr, event_raw, event_type) VALUES ('PROVIDER_DNS', 'Name Server (DNS ''NS'' Records)', 0, 'ENTITY')",
"INSERT INTO tbl_event_types (event, event_descr, event_raw, event_type) VALUES ('PROVIDER_JAVASCRIPT', 'Externally Hosted Javascript', 0, 'ENTITY')",