Skip to content

Commit

Permalink
v0.4.9
Browse files Browse the repository at this point in the history
adding server_name to logging and webhook data
  • Loading branch information
its-a-feature committed Feb 7, 2024
1 parent f21f0b1 commit c5b32b9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
3 changes: 3 additions & 0 deletions mythic_container/LoggingBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,12 +640,14 @@ def __init__(self,
timestamp: str = None,
action: str = None,
data: dict = None,
server_name: str = None,
**kwargs):
self.OperationID = operation_id
self.OperationName = operation_name
self.OperatorUsername = username
self.Timestamp = timestamp
self.Action = action
self.ServerName = server_name
if self.Action == mythic_container.LOG_TYPE_CALLBACK:
self.Data = NewCallbackLoggingData(**data)
elif self.Action == mythic_container.LOG_TYPE_FILE:
Expand Down Expand Up @@ -674,6 +676,7 @@ def to_json(self):
"operator_username": self.OperatorUsername,
"timestamp": self.Timestamp,
"action": self.Action,
"server_name": self.ServerName,
"data": self.Data.to_json()
}

Expand Down
19 changes: 10 additions & 9 deletions mythic_container/WebhookBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class NewCallbackWebhookData:
IntegrityLevel (int): The integrity level of this callback (mirrors Windows integrity levels with 0-5 range and 3+ is High integrity)
"""

def __init__(self,
user: str = None,
host: str = None,
Expand Down Expand Up @@ -98,6 +99,7 @@ class NewFeedbackWebhookData:
DisplayID (int): The display ID of the task that the user would see
"""

def __init__(self,
task_id: int = None,
display_id: int = None,
Expand Down Expand Up @@ -130,6 +132,7 @@ class NewStartupWebhookData:
StartupMessage (str): The message that Mythic started
"""

def __init__(self,
startup_message: str = None,
**kwargs):
Expand Down Expand Up @@ -157,6 +160,7 @@ class NewAlertWebhookData:
Timestamp (str): When this alert was generated
"""

def __init__(self,
operator_id: int = None,
message: str = None,
Expand Down Expand Up @@ -212,12 +216,14 @@ def __init__(self,
operator_username: str = None,
action: str = None,
data: dict = None,
server_name: str = None,
**kwargs):
self.OperationID = operation_id
self.OperationName = operation_name
self.OperationWebhook = operation_webhook
self.OperationChannel = operation_channel
self.OperatorUsername = operator_username
self.ServerName = server_name
self.Action = action
if self.Action == mythic_container.WEBHOOK_TYPE_NEW_CALLBACK:
self.Data = NewCallbackWebhookData(**data)
Expand All @@ -242,6 +248,7 @@ def to_json(self):
"operation_channel": self.OperationChannel,
"operator_username": self.OperatorUsername,
"action": self.Action,
"server_name": self.ServerName,
"data": self.Data if isinstance(self.Data, dict) or self.Data is None else self.Data.to_json()
}

Expand Down Expand Up @@ -321,17 +328,11 @@ def getWebhookChannel(self, inputMsg: WebhookMessage) -> str:
return ""


async def sendWebhookMessage(contents: dict, url: str) -> str:
async def sendWebhookMessage(contents: dict, url: str) -> (int, str):
try:
async with aiohttp.ClientSession() as session:
async with session.post(url, json=contents, ssl=False) as resp:
if resp.status == 200:
responseData = await resp.text()
logger.debug(f"webhook response data: {responseData}")
return responseData
else:
logger.error(f"[-] Failed to send webhook message: {resp}")
return f"[-] Failed to send webhook message: {resp}"
return resp.status, await resp.text()
except Exception as e:
logger.exception(f"[-] Failed to send webhook: {e}")
return f"[-] Failed to send webhook: {e}"
return 400, f"[-] Failed to send webhook: {e}"
4 changes: 2 additions & 2 deletions mythic_container/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from .rabbitmq import rabbitmqConnectionClass
from .mythic_service import start_and_run_forever, test_command

containerVersion = "v1.1.4"
containerVersion = "v1.1.5"

PyPi_version = "0.4.8"
PyPi_version = "0.4.9"

RabbitmqConnection = rabbitmqConnectionClass()

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# This call to setup() does all the work
setup(
name="mythic_container",
version="0.4.8",
version="0.4.9",
description="Functionality for Mythic Services",
long_description=README,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit c5b32b9

Please sign in to comment.