Skip to content

Commit

Permalink
Merge pull request blacklanternsecurity#1753 from domwhewell-sage/add…
Browse files Browse the repository at this point in the history
…-postman-to-social

Add to social and code_repository modules to detect postman profiles and workspace links in pages
  • Loading branch information
TheTechromancer authored Sep 8, 2024
2 parents b7c1ecd + b6732d4 commit ca8ef80
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions bbot/modules/code_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions bbot/modules/social.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ async def setup_after_prep(self, module_test):
<a href="https://gitlab.com/blacklanternsecurity/bbot"/>
<a href="https://gitlab.org/blacklanternsecurity/bbot"/>
<a href="https://hub.docker.com/r/blacklanternsecurity/bbot"/>
<a href="https://www.postman.com/blacklanternsecurity/bbot"/>
</html>
"""
}
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
Expand Down Expand Up @@ -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"
]
)
12 changes: 11 additions & 1 deletion bbot/test/test_step_2/module_tests/test_module_social.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ async def setup_after_prep(self, module_test):
<a href="https://hub.docker.com/r/blacklanternsecurity"/>
<a href="https://hub.docker.com/r/blacklanternsecurity/bbot"/>
<a href="https://hub.docker.com/r/blacklanternSECURITY/bbot"/>
<a href="https://www.postman.com/blacklanternsecurity/bbot"/>
</html>
"""
}
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
Expand All @@ -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"
]
)

0 comments on commit ca8ef80

Please sign in to comment.