The recursive internet scanner for hackers. 🧡
Python asmattack-surface-managementautomationbugbountyclieasmhackingneo4josintosint-frameworkpentestingpythonreconrecursionscannersubdomain-enumerationsubdomain-scannersubdomainsthreat-intelligencethreatintel
Add otilabs subdomain module (#3496)
OTILabsbd552485b8a0
diff --git a/bbot/modules/otilabs.py b/bbot/modules/otilabs.pynew file mode 100644index 000000000..664f88130--- /dev/null+++ b/bbot/modules/otilabs.py@@ -0,0 +1,45 @@+from bbot.modules.templates.subdomain_enum import subdomain_enum_apikey+from bbot.core.config.models import BaseModuleConfig, Field+++class otilabs(subdomain_enum_apikey):+ watched_events = ["DNS_NAME"]+ produced_events = ["DNS_NAME"]+ flags = ["safe", "subdomain-enum", "passive"]+ meta = {+ "description": "Query the OTI Labs Domain Intelligence API for subdomains",+ "created_date": "2026-10-05",+ "author": "@OsirisTechnicalInstitute",+ }++ class Config(BaseModuleConfig):+ api_key: str | list[str] = Field(+ "",+ description="RapidAPI key subscribed to the OTI Labs Domain Intelligence API",+ sensitive=True,+ mandatory=True,+ )++ base_url = "https://domain-intelligence-api.p.rapidapi.com"+ api_host = "domain-intelligence-api.p.rapidapi.com"++ def prepare_api_request(self, url, kwargs):+ kwargs["headers"]["x-rapidapi-host"] = self.api_host+ kwargs["headers"]["x-rapidapi-key"] = self.api_key+ return url, kwargs++ async def request_url(self, query):+ # BBOT queries each domain once, so ask the API to wait for all of its sources (wait=1)+ # instead of returning its fast partial snapshot. That takes 15-20 seconds for a domain+ # the API hasn't seen before and is immediate when it's cached.+ url = f"{self.base_url}/domain/{self.helpers.quote(query)}/subdomains?wait=1"+ return await self.api_request(url, timeout=self.http_timeout_infrastructure + 20)++ async def parse_results(self, r, query):+ results = set()+ j = r.json()+ if isinstance(j, dict):+ for host in j.get("subdomains", []):+ if isinstance(host, str) and host.endswith(f".{query}"):+ results.add(host)+ return resultsdiff --git a/bbot/test/test_step_2/module_tests/test_module_otilabs.py b/bbot/test/test_step_2/module_tests/test_module_otilabs.pynew file mode 100644index 000000000..0e0a71bab--- /dev/null+++ b/bbot/test/test_step_2/module_tests/test_module_otilabs.py@@ -0,0 +1,39 @@+from .base import ModuleTestBase+++class TestOtilabs(ModuleTestBase):+ config_overrides = {"modules": {"otilabs": {"api_key": "asdf"}}}++ async def setup_before_prep(self, module_test):+ # The shape of a real ?wait=1 response for a domain the API hadn't looked up before: every+ # source has finished, and only the live/historical split (live, live_count) is still being+ # computed, which BBOT doesn't need because it resolves the names itself.+ module_test.blasthttp_mock.add_response(+ url="https://domain-intelligence-api.p.rapidapi.com/domain/blacklanternsecurity.com/subdomains?wait=1",+ match_headers={"x-rapidapi-host": "domain-intelligence-api.p.rapidapi.com", "x-rapidapi-key": "asdf"},+ json={+ "count": 3,+ "live_count": None,+ "returned": 3,+ "subdomains": [+ "asdf.blacklanternsecurity.com",+ "zzzz.blacklanternsecurity.com",+ "www.notblacklanternsecurity.com",+ ],+ "sources_used": [+ "certspotter: 2 found",+ "virustotal: 2 found",+ "subfinder: 1 found",+ "crt.sh: unavailable",+ "liveness: enriching",+ ],+ "warnings": ["crt.sh: unavailable"],+ },+ )++ def check(self, module_test, events):+ assert any(e.data == "asdf.blacklanternsecurity.com" for e in events), "Failed to detect live subdomain"+ assert any(e.data == "zzzz.blacklanternsecurity.com" for e in events), "Failed to detect historical subdomain"+ assert not any(e.data == "www.notblacklanternsecurity.com" for e in events), (+ "Emitted a host outside the queried domain"+ )