Skip to content

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

Removed the darksearch.io modules (data source is strictly private now).

smicallef4a0637eb342b
diff --git a/README.md b/README.md
index 65e63e8e..84aa1384 100644
--- a/README.md
+++ b/README.md
@@ -182,7 +182,6 @@ Cross-Referencer|Identify whether other domains are associated ('Affiliates') of
[CRXcavator](https://crxcavator.io/)|Search CRXcavator for Chrome extensions.|Free API
Custom Threat Feed|Check if a host/domain, netblock, ASN or IP is malicious according to your custom feed.|Internal
[CyberCrime-Tracker.net](https://cybercrime-tracker.net/)|Check if a host/domain or IP address is malicious according to CyberCrime-Tracker.net.|Free API
-[Darksearch](https://darksearch.io/)|Search the Darksearch.io Tor search engine for mentions of the target domain.|Free API
[Debounce](https://debounce.io/)|Check whether an email is disposable|Free API
[Dehashed](https://www.dehashed.com/)|Gather breach data from Dehashed API.|Commercial API
[Digital Ocean Space Finder](https://www.digitalocean.com/products/spaces/)|Search for potential Digital Ocean Spaces associated with the target and attempt to list their contents.|Free API
diff --git a/modules/sfp_darksearch.py b/modules/sfp_darksearch.py
deleted file mode 100644
index f1295e63..00000000
--- a/modules/sfp_darksearch.py
+++ /dev/null
@@ -1,217 +0,0 @@
-# -*- coding: utf-8 -*-
-# -------------------------------------------------------------------------------
-# Name: sfp_darksearch
-# Purpose: Searches the Darksearch.io Tor search engine for content related
-# to the domain in question.
-#
-# Author: <bcoles[at]gmail[.]com>
-#
-# Created: 2019-05-11
-# Copyright: (c) bcoles 2019
-# Licence: MIT
-# -------------------------------------------------------------------------------
-
-import json
-import time
-import urllib.error
-import urllib.parse
-import urllib.request
-
-from spiderfoot import SpiderFootEvent, SpiderFootPlugin
-
-
-class sfp_darksearch(SpiderFootPlugin):
-
- meta = {
- 'name': "Darksearch",
- 'summary': "Search the Darksearch.io Tor search engine for mentions of the target domain.",
- 'flags': ["tor"],
- 'useCases': ["Footprint", "Investigate"],
- 'categories': ["Search Engines"],
- 'dataSource': {
- 'website': "https://darksearch.io/",
- 'model': "FREE_NOAUTH_UNLIMITED",
- 'references': [
- "https://darksearch.io/apidoc",
- "https://darksearch.io/dorks"
- ],
- 'favIcon': "https://darksearch.io/favicons/favicon-64.png",
- 'logo': "https://darksearch.io/images/darksearch-logo-02.svg?366834f96a6d3988f0f11f99dba27bf4",
- 'description': "The 1st real Dark Web search engine.\n"
- "Our DarkWeb search engine is completely free.\n"
- "Access the results directly, without the need to install Tor.\n"
- "Our API is available for free to automate your research.",
- }
- }
-
- # Default options
- opts = {
- 'fetchlinks': True,
- 'max_pages': 20,
- 'fullnames': True
- }
-
- # Option descriptions
- optdescs = {
- 'fetchlinks': "Fetch the darknet pages (via TOR, if enabled) to verify they mention your target.",
- 'max_pages': "Maximum number of pages of results to fetch.",
- 'fullnames': "Search for human names?"
- }
-
- results = None
- errorState = False
-
- def setup(self, sfc, userOpts=dict()):
- self.sf = sfc
- self.results = self.tempStorage()
- self.errorState = False
-
- for opt in list(userOpts.keys()):
- self.opts[opt] = userOpts[opt]
-
- def watchedEvents(self):
- return ['DOMAIN_NAME', 'HUMAN_NAME', 'EMAILADDR']
-
- def producedEvents(self):
- return ['DARKNET_MENTION_URL', 'DARKNET_MENTION_CONTENT', 'RAW_RIR_DATA']
-
- # https://darksearch.io/apidoc
- def query(self, qry, page):
- params = {
- 'query': '"' + qry.encode('raw_unicode_escape').decode("ascii", errors='replace') + '"',
- 'page': str(page)
- }
-
- res = self.sf.fetchUrl("https://darksearch.io/api/search?" + urllib.parse.urlencode(params),
- useragent=self.opts['_useragent'],
- timeout=self.opts['_fetchtimeout'])
-
- # Usage policy mandates maximum 30 requests per minute
- time.sleep(2)
-
- if res['content'] is None:
- return None
-
- try:
- return json.loads(res['content'])
- except Exception as e:
- self.debug(f"Error processing JSON response: {e}")
-
- return None
-
- def handleEvent(self, event):
- eventName = event.eventType
- srcModuleName = event.module
- eventData = event.data
-
- if not self.opts['fullnames'] and eventName == 'HUMAN_NAME':
- return
-
- if eventData in self.results:
- self.debug(f"Skipping {eventData}, already checked.")
- return
-
- self.results[eventData] = True
-
- self.debug(f"Received event, {eventName}, from {srcModuleName}")
-
- page = 1
- pages = self.opts['max_pages']
- while page <= pages:
- found = False
-
- if self.checkForStop():
- return
-
- query_results = self.query(eventData, page)
-
- if query_results is None:
- return
-
- page += 1
-
- last_page = query_results.get('last_page')
-
- if last_page is None:
- pages = 0
-
- if last_page < pages:
- pages = last_page
-
- data = query_results.get('data')
-
- if data is None:
- return
-
- for result in data:
- if result is None:
- continue
-
- link = result.get('link')
-
- if link is None:
- continue
-
- if link in self.results:
- continue
-
- if not self.sf.urlFQDN(link).endswith(".onion"):
- continue
-
- self.results[link] = True
- self.debug("Found a darknet mention: " + link)
-
- if self.opts['fetchlinks']:
- res = self.sf.fetchUrl(link,
- timeout=self.opts['_fetchtimeout'],
- useragent=self.opts['_useragent'],
- verify=False)
-
- if res['content'] is None:
- self.debug("Ignoring " + link + " as no data returned")
- continue
-
- if eventData not in res['content']:
- self.debug("Ignoring " + link + " as no mention of " + eventData)
- continue
-
- evt = SpiderFootEvent("DARKNET_MENTION_URL", link, self.__name__, event)
- self.notifyListeners(evt)
- found = True
-
- # extract content excerpt
- try:
- startIndex = res['content'].index(eventData) - 120
- endIndex = startIndex + len(eventData) + 240
- except Exception:
- self.debug("String not found in content.")
- continue
-
- data = res['content'][startIndex:endIndex]
- evt = SpiderFootEvent("DARKNET_MENTION_CONTENT",
- "..." + data + "...",
- self.__name__,
- event)
- self.notifyListeners(evt)
-
- else:
- evt = SpiderFootEvent("DARKNET_MENTION_URL", link, self.__name__, event)
- self.notifyListeners(evt)
- found = True
-
- if result.get('title') is None and result.get('description') is None:
- self.debug("Ignoring " + link + " as no mention of " + eventData)
- continue
-
- evt = SpiderFootEvent("DARKNET_MENTION_CONTENT",
- "Title: " + result.get('title') + "\n\n"
- + "..." + result.get('description') + "...",
- self.__name__,
- event)
- self.notifyListeners(evt)
-
- if found:
- evt = SpiderFootEvent("RAW_RIR_DATA", str(query_results), self.__name__, event)
- self.notifyListeners(evt)
-
-# End of sfp_darksearch class
diff --git a/test/integration/modules/test_sfp_darksearch.py b/test/integration/modules/test_sfp_darksearch.py
deleted file mode 100644
index ec519b1f..00000000
--- a/test/integration/modules/test_sfp_darksearch.py
+++ /dev/null
@@ -1,32 +0,0 @@
-import pytest
-import unittest
-
-from modules.sfp_darksearch import sfp_darksearch
-from sflib import SpiderFoot
-from spiderfoot import SpiderFootEvent, SpiderFootTarget
-
-
-class TestModuleIntegrationDarksearch(unittest.TestCase):
-
- @unittest.skip("todo")
- def test_handleEvent(self):
- sf = SpiderFoot(self.default_options)
-
- module = sfp_darksearch()
- module.setup(sf, dict())
-
- target_value = 'example target value'
- target_type = 'IP_ADDRESS'
- target = SpiderFootTarget(target_value, target_type)
- module.setTarget(target)
-
- event_type = 'ROOT'
- event_data = 'example data'
- event_module = ''
- source_event = ''
- evt = SpiderFootEvent(event_type, event_data, event_module, source_event)
-
- result = module.handleEvent(evt)
-
- self.assertIsNone(result)
diff --git a/test/unit/modules/test_sfp_darksearch.py b/test/unit/modules/test_sfp_darksearch.py
deleted file mode 100644
index abc63e22..00000000
--- a/test/unit/modules/test_sfp_darksearch.py
+++ /dev/null
@@ -1,26 +0,0 @@
-import pytest
-import unittest
-
-from modules.sfp_darksearch import sfp_darksearch
-from sflib import SpiderFoot
-
-
-class TestModuleDarksearch(unittest.TestCase):
-
- def test_opts(self):
- module = sfp_darksearch()
- self.assertEqual(len(module.opts), len(module.optdescs))
-
- def test_setup(self):
- sf = SpiderFoot(self.default_options)
- module = sfp_darksearch()
- module.setup(sf, dict())
-
- def test_watchedEvents_should_return_list(self):
- module = sfp_darksearch()
- self.assertIsInstance(module.watchedEvents(), list)
-
- def test_producedEvents_should_return_list(self):
- module = sfp_darksearch()
- self.assertIsInstance(module.producedEvents(), list)