From b6732d4b0f194691b6e96279f592ba88e044f045 Mon Sep 17 00:00:00 2001 From: Dom Whewell Date: Sun, 8 Sep 2024 13:58:58 +0100 Subject: [PATCH] Add a regex to detect postman profiles and code repositorys --- bbot/modules/code_repository.py | 1 + bbot/modules/social.py | 1 + .../module_tests/test_module_code_repository.py | 12 +++++++++++- .../test_step_2/module_tests/test_module_social.py | 12 +++++++++++- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/bbot/modules/code_repository.py b/bbot/modules/code_repository.py index 372c73b08..f485579f9 100644 --- a/bbot/modules/code_repository.py +++ b/bbot/modules/code_repository.py @@ -19,6 +19,7 @@ class code_repository(BaseModule): (r"gitlab.(?:com|org)/[a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+", False), ], "docker": (r"hub.docker.com/r/[a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+", False), + "postman": (r"www.postman.com/[a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+", False), } scope_distance_modifier = 1 diff --git a/bbot/modules/social.py b/bbot/modules/social.py index 0c834cd7f..5833228a0 100644 --- a/bbot/modules/social.py +++ b/bbot/modules/social.py @@ -25,6 +25,7 @@ class social(BaseModule): "discord": (r"discord.gg/([a-zA-Z0-9_-]+)", True), "docker": (r"hub.docker.com/[ru]/([a-zA-Z0-9_-]+)", False), "huggingface": (r"huggingface.co/([a-zA-Z0-9_-]+)", False), + "postman": (r"www.postman.com/([a-zA-Z0-9_-]+)", False), } scope_distance_modifier = 1 diff --git a/bbot/test/test_step_2/module_tests/test_module_code_repository.py b/bbot/test/test_step_2/module_tests/test_module_code_repository.py index 3bda459c8..bfb01ef03 100644 --- a/bbot/test/test_step_2/module_tests/test_module_code_repository.py +++ b/bbot/test/test_step_2/module_tests/test_module_code_repository.py @@ -14,13 +14,14 @@ async def setup_after_prep(self, module_test): + """ } module_test.set_expect_requests(expect_args=expect_args, respond_args=respond_args) def check(self, module_test, events): - assert 4 == len([e for e in events if e.type == "CODE_REPOSITORY"]) + assert 5 == len([e for e in events if e.type == "CODE_REPOSITORY"]) assert 1 == len( [ e @@ -57,3 +58,12 @@ def check(self, module_test, events): and e.data["url"] == "https://hub.docker.com/r/blacklanternsecurity/bbot" ] ) + assert 1 == len( + [ + e + for e in events + if e.type == "CODE_REPOSITORY" + and "postman" in e.tags + and e.data["url"] == "https://www.postman.com/blacklanternsecurity/bbot" + ] + ) diff --git a/bbot/test/test_step_2/module_tests/test_module_social.py b/bbot/test/test_step_2/module_tests/test_module_social.py index 627643746..6b03c77ed 100644 --- a/bbot/test/test_step_2/module_tests/test_module_social.py +++ b/bbot/test/test_step_2/module_tests/test_module_social.py @@ -14,13 +14,14 @@ async def setup_after_prep(self, module_test): + """ } module_test.set_expect_requests(expect_args=expect_args, respond_args=respond_args) def check(self, module_test, events): - assert 3 == len([e for e in events if e.type == "SOCIAL"]) + assert 4 == len([e for e in events if e.type == "SOCIAL"]) assert 1 == len( [ e @@ -46,3 +47,12 @@ def check(self, module_test, events): and e.data["profile_name"] == "blacklanternsecurity" ] ) + assert 1 == len( + [ + e + for e in events + if e.type == "SOCIAL" + and e.data["platform"] == "postman" + and e.data["profile_name"] == "blacklanternsecurity" + ] + )