From 59391aec7b5635046058e29ae3a0d08087f0c5d5 Mon Sep 17 00:00:00 2001 From: TheTechromancer Date: Thu, 9 Nov 2023 10:35:40 -0500 Subject: [PATCH] fix webhook tests --- bbot/test/conftest.py | 2 +- bbot/test/test_step_2/module_tests/test_module_discord.py | 4 ++-- bbot/test/test_step_2/module_tests/test_module_slack.py | 2 +- bbot/test/test_step_2/module_tests/test_module_teams.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bbot/test/conftest.py b/bbot/test/conftest.py index 67e7515ff7..1e1d88e828 100644 --- a/bbot/test/conftest.py +++ b/bbot/test/conftest.py @@ -25,7 +25,7 @@ def pytest_sessionfinish(session, exitstatus): @pytest.fixture def non_mocked_hosts() -> list: - return ["127.0.0.1", "localhost"] + interactsh_servers + return ["127.0.0.1", "localhost", "github.com"] + interactsh_servers @pytest.fixture diff --git a/bbot/test/test_step_2/module_tests/test_module_discord.py b/bbot/test/test_step_2/module_tests/test_module_discord.py index 35f6250c47..2a41438523 100644 --- a/bbot/test/test_step_2/module_tests/test_module_discord.py +++ b/bbot/test/test_step_2/module_tests/test_module_discord.py @@ -7,7 +7,7 @@ class TestDiscord(ModuleTestBase): targets = ["http://127.0.0.1:8888/cookie.aspx", "http://127.0.0.1:8888/cookie2.aspx"] modules_overrides = ["discord", "excavate", "badsecrets", "httpx"] - webhook_url = "output_modules.discord.webhook_url=https://discord.com/api/webhooks/1234/deadbeef-P-uF-asdf" + webhook_url = "https://discord.com/api/webhooks/1234/deadbeef-P-uF-asdf" config_overrides = {"output_modules": {"discord": {"webhook_url": webhook_url}}} def custom_setup(self, module_test): @@ -31,7 +31,7 @@ def custom_response(request: httpx.Request): else: return httpx.Response(status_code=module_test.module.good_status_code) - module_test.httpx_mock.add_callback(custom_response) + module_test.httpx_mock.add_callback(custom_response, url=self.webhook_url) def check(self, module_test, events): vulns = [e for e in events if e.type == "VULNERABILITY"] diff --git a/bbot/test/test_step_2/module_tests/test_module_slack.py b/bbot/test/test_step_2/module_tests/test_module_slack.py index 33a3e74a01..b486d7df29 100644 --- a/bbot/test/test_step_2/module_tests/test_module_slack.py +++ b/bbot/test/test_step_2/module_tests/test_module_slack.py @@ -5,5 +5,5 @@ class TestSlack(DiscordBase): targets = ["http://127.0.0.1:8888/cookie.aspx", "http://127.0.0.1:8888/cookie2.aspx"] modules_overrides = ["slack", "excavate", "badsecrets", "httpx"] - webhook_url = "output_modules.slack.webhook_url=https://hooks.slack.com/services/deadbeef/deadbeef/deadbeef" + webhook_url = "https://hooks.slack.com/services/deadbeef/deadbeef/deadbeef" config_overrides = {"output_modules": {"slack": {"webhook_url": webhook_url}}} diff --git a/bbot/test/test_step_2/module_tests/test_module_teams.py b/bbot/test/test_step_2/module_tests/test_module_teams.py index ead4caf243..f544f5cb9c 100644 --- a/bbot/test/test_step_2/module_tests/test_module_teams.py +++ b/bbot/test/test_step_2/module_tests/test_module_teams.py @@ -26,4 +26,4 @@ def custom_response(request: httpx.Request): text="1", ) - module_test.httpx_mock.add_callback(custom_response) + module_test.httpx_mock.add_callback(custom_response, url=self.webhook_url)