diff --git a/bbot/modules/leakix.py b/bbot/modules/leakix.py index 0d697c4ff0..ba098f800f 100644 --- a/bbot/modules/leakix.py +++ b/bbot/modules/leakix.py @@ -17,6 +17,13 @@ class leakix(subdomain_enum_apikey): base_url = "https://leakix.net" ping_url = f"{base_url}/host/1.1.1.1" + async def setup(self): + ret = await super(subdomain_enum_apikey, self).setup() + self.api_key = self.config.get("api_key", "") + if self.api_key: + return await self.require_api_key() + return ret + def prepare_api_request(self, url, kwargs): if self.api_key: kwargs["headers"]["api-key"] = self.api_key diff --git a/bbot/test/test_step_2/module_tests/test_module_leakix.py b/bbot/test/test_step_2/module_tests/test_module_leakix.py index 0c7a0a5290..13b9221594 100644 --- a/bbot/test/test_step_2/module_tests/test_module_leakix.py +++ b/bbot/test/test_step_2/module_tests/test_module_leakix.py @@ -30,6 +30,10 @@ class TestLeakIX_NoAPIKey(ModuleTestBase): modules_overrides = ["leakix"] async def setup_before_prep(self, module_test): + module_test.httpx_mock.add_response( + url="https://leakix.net/host/1.1.1.1", + json={"title": "Not Found", "description": "Host not found"}, + ) module_test.httpx_mock.add_response( url=f"https://leakix.net/api/subdomains/blacklanternsecurity.com", json=[