Skip to content

Commit

Permalink
Merge pull request #1760 from domwhewell-sage/dev
Browse files Browse the repository at this point in the history
Fix Teams output module
  • Loading branch information
TheTechromancer authored Sep 9, 2024
2 parents 2bf9d6c + 465d089 commit 8056c0a
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions bbot/modules/output/teams.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,10 @@ class Teams(WebhookOutputModule):
"min_severity": "Only allow VULNERABILITY events of this severity or higher",
}
_module_threads = 5
adaptive_card = {
"type": "message",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"contentUrl": None,
"content": {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.2",
"msteams": {"width": "full"},
"body": [],
},
}
],
}

async def handle_event(self, event):
while 1:
data = self.format_message(self.adaptive_card.copy(), event)
data = self.format_message(event)

response = await self.helpers.request(
url=self.webhook_url,
Expand Down Expand Up @@ -89,7 +73,23 @@ def get_severity_color(self, event):
color = "Good"
return color

def format_message(self, adaptive_card, event):
def format_message(self, event):
adaptive_card = {
"type": "message",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"contentUrl": None,
"content": {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.2",
"msteams": {"width": "full"},
"body": [],
},
}
],
}
heading = {"type": "TextBlock", "text": f"{event.type}", "wrap": True, "size": "Large", "style": "heading"}
body = adaptive_card["attachments"][0]["content"]["body"]
body.append(heading)
Expand Down

0 comments on commit 8056c0a

Please sign in to comment.