Skip to content

Commit 8ca4d78

Browse files
committed
v0.4.10
1 parent c5b32b9 commit 8ca4d78

File tree

6 files changed

+46
-11
lines changed

6 files changed

+46
-11
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11

2+
## [v0.4.10] - 2024-02-13
3+
4+
### Changed
5+
6+
- Added access to "Secrets" in tasking, dynamic queries, new callbacks, and payload builds
7+
- Added `message_format` attribute for Payload Types for use later
8+
29
## [v0.4.8] - 2024-01-23
310

411
### Changed

mythic_container/MythicCommandBase.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ class PTRPCDynamicQueryFunctionMessage:
192192
AgentCallbackID (str): Agent UUID of the callback where this function is called
193193
PayloadOS (str): The selected OS when the backing payload for this callback was created
194194
PayloadUUID (str): The UUID of the backing payload for this callback that can be used to fetch more information
195-
195+
Secrets (dict): User secrets based on the operator that issued this action
196196
Functions:
197197
to_json(self): return dictionary form of class
198198
"""
@@ -206,6 +206,7 @@ def __init__(self,
206206
payload_uuid: str = "",
207207
agent_callback_id: str = "",
208208
callback_display_id: int = 0,
209+
secrets: dict = {},
209210
**kwargs
210211
):
211212
self.Command = command
@@ -216,6 +217,7 @@ def __init__(self,
216217
self.PayloadUUID = payload_uuid
217218
self.AgentCallbackID = agent_callback_id
218219
self.CallbackDisplayID = callback_display_id
220+
self.Secrets = secrets
219221

220222
def to_json(self):
221223
return {
@@ -226,7 +228,8 @@ def to_json(self):
226228
"payload_os": self.PayloadOS,
227229
"payload_uuid": self.PayloadUUID,
228230
"agent_callback_id": self.AgentCallbackID,
229-
"callback_display_id": self.CallbackDisplayID
231+
"callback_display_id": self.CallbackDisplayID,
232+
"secrets": self.Secrets
230233
}
231234

232235
def __str__(self):
@@ -1624,6 +1627,7 @@ class PTTaskMessageAllData:
16241627
BuildParameters (list[MythicRPCPayloadConfigurationBuildParameter]): Information about the build parameters used to generate the payload for this callback
16251628
C2Profiles (list[MythicRPCPayloadConfigurationC2Profile]): Information about the c2 profiles associated with this callback and their values
16261629
args: The running instance of arguments for this task, this allows you to modify any arguments as necessary in your `create_go_tasking` function
1630+
Secrets (dict): Dictionary of secrets associated with the user for this action
16271631
16281632
Functions:
16291633
to_json(self): return dictionary form of class
@@ -1639,6 +1643,7 @@ def __init__(self,
16391643
c2info: list[dict] = [],
16401644
payload_type: str = "",
16411645
args: TaskArguments.__class__ = None,
1646+
secrets: dict = {},
16421647
**kwargs):
16431648
self.Task = PTTaskMessageTaskData(**task)
16441649
self.Callback = PTTaskMessageCallbackData(**callback)
@@ -1647,6 +1652,7 @@ def __init__(self,
16471652
self.PayloadType = payload_type
16481653
self.BuildParameters = [MythicRPCPayloadConfigurationBuildParameter(**x) for x in build_parameters]
16491654
self.C2Profiles = [MythicRPCPayloadConfigurationC2Profile(**x) for x in c2info]
1655+
self.Secrets = secrets
16501656
if args is not None:
16511657
self.args = args(command_line=task["params"],
16521658
tasking_location=task["tasking_location"],
@@ -1666,7 +1672,8 @@ def to_json(self):
16661672
"commands": self.Commands,
16671673
"payload": self.Payload.to_json(),
16681674
"c2info": [x.to_json() for x in self.C2Profiles],
1669-
"payload_type": self.PayloadType
1675+
"payload_type": self.PayloadType,
1676+
"secrets": self.Secrets
16701677
}
16711678

16721679
def set_args(self, args: TaskArguments.__class__) -> None:
@@ -1690,6 +1697,7 @@ class PTOnNewCallbackAllData:
16901697
PayloadType (str): The name of the payload type
16911698
BuildParameters (list[MythicRPCPayloadConfigurationBuildParameter]): Information about the build parameters used to generate the payload for this callback
16921699
C2Profiles (list[MythicRPCPayloadConfigurationC2Profile]): Information about the c2 profiles associated with this callback and their values
1700+
Secrets (dict): Dictionary of secrets from the user associated with this action
16931701
16941702
Functions:
16951703
to_json(self): return dictionary form of class
@@ -1702,13 +1710,15 @@ def __init__(self,
17021710
payload: dict = {},
17031711
c2info: list[dict] = [],
17041712
payload_type: str = "",
1713+
secrets: dict = {},
17051714
**kwargs):
17061715
self.Callback = PTTaskMessageCallbackData(**callback)
17071716
self.Payload = PTTaskMessagePayloadData(**payload)
17081717
self.Commands = commands
17091718
self.PayloadType = payload_type
17101719
self.BuildParameters = [MythicRPCPayloadConfigurationBuildParameter(**x) for x in build_parameters]
17111720
self.C2Profiles = [MythicRPCPayloadConfigurationC2Profile(**x) for x in c2info]
1721+
self.Secrets = secrets
17121722

17131723
for k, v in kwargs.items():
17141724
logger.info(f"unknown kwarg {k} with value {v}")
@@ -1720,7 +1730,8 @@ def to_json(self):
17201730
"commands": self.Commands,
17211731
"payload": self.Payload.to_json(),
17221732
"c2info": [x.to_json() for x in self.C2Profiles],
1723-
"payload_type": self.PayloadType
1733+
"payload_type": self.PayloadType,
1734+
"secrets": self.Secrets
17241735
}
17251736

17261737
def __str__(self):

mythic_container/MythicGoRPC/send_mythic_rpc_payload_create_from_scratch.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,33 @@
33

44
MYTHIC_RPC_PAYLOAD_CREATE_FROM_SCRATCH = "mythic_rpc_payload_create_from_scratch"
55

6+
67
class MythicRPCPayloadConfigurationC2Profile:
78
def __init__(self,
89
Name: str = None,
910
Parameters: dict = None,
1011
c2_profile: str = None,
12+
c2_profile_is_p2p: bool = False,
1113
c2_profile_parameters: dict = None,
1214
**kwargs):
1315
self.Name = Name
1416
self.Parameters = Parameters
17+
self.IsP2P = c2_profile_is_p2p
1518
if c2_profile is not None:
1619
self.Name = c2_profile
1720
if c2_profile_parameters is not None:
1821
self.Parameters = c2_profile_parameters
1922
for k, v in kwargs.items():
2023
logger.info(f"Unknown kwarg {k} - {v}")
24+
2125
def to_json(self):
2226
return {
2327
"c2_profile": self.Name,
24-
"c2_profile_parameters": self.Parameters
28+
"c2_profile_parameters": self.Parameters,
29+
"c2_profile_is_p2p": self.IsP2P
2530
}
31+
32+
2633
class MythicRPCPayloadConfigurationBuildParameter:
2734
def __init__(self,
2835
Name: str = None,
@@ -38,11 +45,14 @@ def __init__(self,
3845
self.Value = value
3946
for k, v in kwargs.items():
4047
logger.info(f"Unknown kwarg {k} - {v}")
48+
4149
def to_json(self):
4250
return {
4351
"name": self.Name,
4452
"value": self.Value
4553
}
54+
55+
4656
class MythicRPCPayloadConfiguration:
4757
def __init__(self,
4858
Description: str = None,
@@ -119,7 +129,8 @@ def __init__(self,
119129

120130
async def SendMythicRPCPayloadCreateFromScratch(
121131
msg: MythicRPCPayloadCreateFromScratchMessage) -> MythicRPCPayloadCreateFromScratchMessageResponse:
122-
response = await mythic_container.RabbitmqConnection.SendRPCDictMessage(queue=MYTHIC_RPC_PAYLOAD_CREATE_FROM_SCRATCH,
123-
body=msg.to_json())
132+
response = await mythic_container.RabbitmqConnection.SendRPCDictMessage(
133+
queue=MYTHIC_RPC_PAYLOAD_CREATE_FROM_SCRATCH,
134+
body=msg.to_json())
124135

125136
return MythicRPCPayloadCreateFromScratchMessageResponse(**response)

mythic_container/PayloadBuilder.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,8 @@ class PayloadType:
494494
The path to the folder holding your browser scripts so that they can be fetched when Syncing
495495
custom_rpc_functions (dict):
496496
Dictionary of RPC name to awaitable RPC function that other services can call
497+
message_format (str):
498+
Defaults to `json`, but you can optionally specify `xml` to have your messages parsed and returned as xml instead of JSON for Mythic
497499
498500
Functions:
499501
build(self):
@@ -518,6 +520,7 @@ class PayloadType:
518520
agent_path = None
519521
agent_code_path = None
520522
agent_browserscript_path = None
523+
message_format = 'json'
521524
custom_rpc_functions: dict[
522525
str, Callable[[PTOtherServiceRPCMessage], Awaitable[PTOtherServiceRPCMessageResponse]]] = {}
523526

@@ -529,7 +532,8 @@ def __init__(
529532
selected_os: str = None,
530533
commands: CommandList = None,
531534
wrapped_payload_uuid: str = None,
532-
wrapped_payload: bytes = None
535+
wrapped_payload: bytes = None,
536+
secrets: dict = {},
533537
):
534538
self.uuid = uuid
535539
self.c2info = c2info
@@ -538,6 +542,7 @@ def __init__(
538542
self.filename = filename
539543
self.wrapped_payload = wrapped_payload
540544
self.wrapped_payload_uuid = wrapped_payload_uuid
545+
self.secrets = secrets
541546
if self.agent_path is None:
542547
self.agent_path = pathlib.Path(".") / self.name
543548
logger.error(f"{self.name} has no agent_path set, setting to {self.agent_path}")
@@ -656,6 +661,7 @@ def to_json(self):
656661
"mythic_encrypts": self.mythic_encrypts,
657662
"build_steps": [x.to_json() for x in self.build_steps],
658663
"agent_icon": base64.b64encode(agent_bytes).decode(),
664+
"message_format": self.message_format,
659665
}
660666

661667
def __str__(self):

mythic_container/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from .rabbitmq import rabbitmqConnectionClass
22
from .mythic_service import start_and_run_forever, test_command
33

4-
containerVersion = "v1.1.5"
4+
containerVersion = "v1.1.6"
55

6-
PyPi_version = "0.4.9"
6+
PyPi_version = "0.4.10"
77

88
RabbitmqConnection = rabbitmqConnectionClass()
99

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# This call to setup() does all the work
1111
setup(
1212
name="mythic_container",
13-
version="0.4.9",
13+
version="0.4.10",
1414
description="Functionality for Mythic Services",
1515
long_description=README,
1616
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)