-
Notifications
You must be signed in to change notification settings - Fork 562
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
github-actions
committed
Oct 23, 2024
1 parent
51e745a
commit 6821a1e
Showing
2 changed files
with
43 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
bbot/test/test_step_2/module_tests/test_module_bufferoverrun.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from .base import ModuleTestBase | ||
|
||
|
||
class TestBufferOverrun(ModuleTestBase): | ||
config_overrides = {"modules": {"bufferoverrun": {"api_key": "asdf", "commercial": False}}} | ||
|
||
async def setup_before_prep(self, module_test): | ||
# Mock response for non-commercial API | ||
module_test.httpx_mock.add_response( | ||
url="https://tls.bufferover.run/dns?q=.blacklanternsecurity.com", | ||
match_headers={"x-api-key": "asdf"}, | ||
json={"Results": ["1.2.3.4,example.com,*,*,sub.blacklanternsecurity.com"]}, | ||
) | ||
|
||
def check(self, module_test, events): | ||
assert any(e.data == "sub.blacklanternsecurity.com" for e in events), "Failed to detect subdomain for free API" | ||
|
||
|
||
class TestBufferOverrunCommercial(ModuleTestBase): | ||
modules_overrides = ["bufferoverrun"] | ||
module_name = "bufferoverrun" | ||
config_overrides = {"modules": {"bufferoverrun": {"api_key": "asdf", "commercial": True}}} | ||
|
||
async def setup_before_prep(self, module_test): | ||
# Mock response for commercial API | ||
module_test.httpx_mock.add_response( | ||
url="https://bufferover-run-tls.p.rapidapi.com/ipv4/dns?q=.blacklanternsecurity.com", | ||
match_headers={"x-rapidapi-host": "bufferover-run-tls.p.rapidapi.com", "x-rapidapi-key": "asdf"}, | ||
json={"Results": ["5.6.7.8,blacklanternsecurity.com,*,*,sub.blacklanternsecurity.com"]}, | ||
) | ||
|
||
def check(self, module_test, events): | ||
assert any( | ||
e.data == "sub.blacklanternsecurity.com" for e in events | ||
), "Failed to detect subdomain for commercial API" |