Skip to content

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

sfp_wigle: Expect coordinate events directly instead of querying Wigle.

smicalleffcb678cc2b64
diff --git a/modules/sfp_wigle.py b/modules/sfp_wigle.py
index 3f0ec85c..d3d83bcf 100644
--- a/modules/sfp_wigle.py
+++ b/modules/sfp_wigle.py
@@ -83,51 +83,19 @@ class sfp_wigle(SpiderFootPlugin):
# What events is this module interested in for input
def watchedEvents(self):
- return ["PHYSICAL_ADDRESS"]
+ return ["PHYSICAL_COORDINATES"]
# What events this module produces
def producedEvents(self):
return ["WIFI_ACCESS_POINT"]
- def getcoords(self, qry):
- params = {
- 'addresscode': qry.encode('utf-8', errors='replace')
- }
- hdrs = {
- "Accept": "application/json",
- "Authorization": "Basic " + self.opts['api_key_encoded']
- }
-
- res = self.sf.fetchUrl(
- "https://api.wigle.net/api/v2/network/geocode?" + urllib.parse.urlencode(params),
- timeout=30,
- useragent="SpiderFoot",
- headers=hdrs
- )
-
- if res['code'] == "404" or not res['content']:
- return None
-
- if "too many queries" in res['content']:
- self.error("Wigle.net query limit reached for the day.")
- return None
-
- try:
- info = json.loads(res['content'])
- if len(info.get('results', [])) == 0:
- return None
- return info['results'][0]['boundingbox']
- except Exception as e:
- self.error(f"Error processing JSON response from Wigle.net: {e}")
- return None
-
def getnetworks(self, coords):
params = {
'onlymine': 'false',
'latrange1': str(coords[0]),
- 'latrange2': str(coords[1]),
- 'longrange1': str(coords[2]),
- 'longrange2': str(coords[3]),
+ 'latrange2': str(coords[0]),
+ 'longrange1': str(coords[1]),
+ 'longrange2': str(coords[1]),
'freenet': 'false',
'paynet': 'false',
'variance': self.opts['variance']
@@ -207,12 +175,7 @@ class sfp_wigle(SpiderFootPlugin):
self.results[eventData] = True
- coords = self.getcoords(eventData)
- if not coords:
- self.error("Couldn't get coordinates for address from Wigle.net.")
- return
-
- nets = self.getnetworks(coords)
+ nets = self.getnetworks(eventData.replace(" ", "").split(","))
if not nets:
self.error("Couldn't get networks for coordinates from Wigle.net.")
return