Skip to content

Commit

Permalink
Merge pull request #1 from MythicMeta/v0.2.8-rc01
Browse files Browse the repository at this point in the history
v0.2.8
  • Loading branch information
its-a-feature authored May 18, 2023
2 parents 5c57092 + a875513 commit 37dab07
Show file tree
Hide file tree
Showing 8 changed files with 380 additions and 69 deletions.
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## [v0.2.8-rc05] - 2023-05-18

### Changed

- Updated the type validation keys from a typo for CredentialJson parameter types

## [v0.2.8-rc04] - 2023-05-17

### Changed

- Decoded response searches back to string instead of leaving as bytes

## [v0.2.8-rc02] - 2023-05-12

### Changed

- Fixed some bugs with how translation services handle timeouts and reconnects


## [0.2.8-rc01] - 2023-05-10

### Changed

- Updated the final JSON string from tasking to not include Null values
- Updated the create tasking's Stdout to include information about which arguments aren't getting used and why
4 changes: 1 addition & 3 deletions mythic_container/C2ProfileBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -834,9 +834,7 @@ def to_json(self):
return {
"name": self.name,
"description": self.description,
"default_value": self.default_value if self.parameter_type not in [ParameterType.Array,
ParameterType.Dictionary] else json.dumps(
self.default_value),
"default_value": self.default_value,
"randomize": self.randomize,
"format_string": self.format_string,
"required": self.required,
Expand Down
34 changes: 31 additions & 3 deletions mythic_container/MythicCommandBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class SupportedOS:
Windows = "Windows"
MacOS = "macOS"
Linux = "Linux"
WebShell = "WebShell"
Chrome = "Chrome"

def __init__(self, os: str):
Expand Down Expand Up @@ -509,7 +508,7 @@ def validateAgentConnect(self, val):
"Boolean": validateBoolean,
"File": validateFile,
"Array": validateArray,
"Credential-JSON": validateCredentialJSON,
"CredentialJson": validateCredentialJSON,
"ChooseOne": validatePass,
"ChooseMultiple": validateChooseMultiple,
"PayloadList": validatePayloadList,
Expand Down Expand Up @@ -752,6 +751,33 @@ async def verify_required_args_have_values(self) -> bool:
raise ValueError("Required arg {} has no value".format(arg.name))
return True

async def get_unused_args(self) -> str:
if len(self.args) > 0:
caughtException = ""
try:
if self.manual_args is not None:
groupName = ""
else:
groupName = self.get_parameter_group_name()
except Exception as e:
logger.error(f"Failed to get group name for tasking: {e}\n")
caughtException = f"Failed to get group name for tasking: {e}\n"
groupName = "N/A"
temp = {}
for arg in self.args:
matched_arg = False
for group_info in arg.parameter_group_info:
if group_info.group_name == groupName:
matched_arg = True
if not matched_arg:
if isinstance(arg.value, bytes):
temp[arg.name] = base64.b64encode(arg.value).decode()
else:
temp[arg.name] = arg.value
return f"The following args aren't being used because they don't belong to the {groupName} parameter group: \n{json.dumps(temp, indent=2)}\n{caughtException}"
else:
return ""

def __str__(self) -> str:
if self.manual_args is not None:
if isinstance(self.manual_args, dict):
Expand All @@ -772,8 +798,10 @@ def __str__(self) -> str:
if matched_arg:
if isinstance(arg.value, bytes):
temp[arg.name] = base64.b64encode(arg.value).decode()
else:
elif arg.value is not None:
temp[arg.name] = arg.value
else:
logger.debug(f"Argument {arg.name} has a Null value, not adding it to JSON")
return json.dumps(temp)
else:
return self.command_line
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __init__(self,
task_id: int = None,
**kwargs):
self.ResponseID = response_id
self.Response = base64.b64decode(response)
self.Response = base64.b64decode(response).decode()
self.TaskID = task_id
for k, v in kwargs.items():
logger.info(f"Unknown kwarg {k} - {v}")
Expand Down
Loading

0 comments on commit 37dab07

Please sign in to comment.