Skip to content

Commit

Permalink
UI and Server fixes for dynamic command augmentation
Browse files Browse the repository at this point in the history
  • Loading branch information
its-a-feature committed Dec 13, 2024
1 parent 3c87e7b commit 9cdd6c6
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 20 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.3.1-rc30] - 2024-12-12

### Changed

- Fixed an issue where dynamic query functions for command augmentation commands would go to the base agent instead of the right augmentation container

## [3.3.1-rc29] - 2024-12-10

### Changed
Expand Down
8 changes: 8 additions & 0 deletions MythicReactUI/CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.2.65] - 2024-12-12

### Changed

- Fixed an issue with clashing parameter choices and dynamic query choices
- a parameter that has dynamic query parameter choices will populate the dropdowns in a modal
- a parameter that has dynamic query parameter choices AND choices defined will have the choices used on the command line with tab and the dynamic choices appear in the modal

## [0.2.64] - 2024-12-11

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export function TaskParametersDialogRow(props){
})
useEffect( () => {
if(props.dynamic_query_function !== ""){
if(ChoiceOptions.length === 0 && !usingDynamicParamChoices.current){
if(!usingDynamicParamChoices.current){
setBackdropOpen(true);
snackActions.info("Querying payload type container for options...", {autoClose: 1000});
getDynamicParams({variables:{
Expand Down Expand Up @@ -237,11 +237,15 @@ export function TaskParametersDialogRow(props){
setTypedArrayValue(props.value);
setValue(props.value);
}
setChoiceOptions(props.choices);
if(props.dynamic_query_function === ""){
setChoiceOptions(props.choices);
}
} else if (currentParameterGroup.current !== props.parameterGroupName){
setTypedArrayValue(props.value);
setValue(props.value);
setChoiceOptions(props.choices);
if(props.dynamic_query_function === ""){
setChoiceOptions(props.choices);
}
}
}else if(props.type === "ChooseMultiple" && props.dynamic_query_function === ""){
//console.log("ChooseMultiple", props.value, value);
Expand Down
2 changes: 1 addition & 1 deletion MythicReactUI/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {snackActions} from './components/utilities/Snackbar';
import jwt_decode from 'jwt-decode';
import {meState} from './cache';

export const mythicUIVersion = "0.2.64";
export const mythicUIVersion = "0.2.65";

let fetchingNewToken = false;

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.1-rc29
3.3.1-rc30
2 changes: 1 addition & 1 deletion mythic-docker/src/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.1-rc29
3.3.1-rc30
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,19 @@ func (r *rabbitMQConnection) SendPtRPCDynamicQueryFunction(dynamicQuery PTRPCDyn
callback.agent_callback_id,
callback.display_id,
payload.os "payload.os",
payload.uuid "payload.uuid"
payload.uuid "payload.uuid",
payloadtype.name "payload.payloadtype.name"
FROM callback
JOIN payload on callback.registered_payload_id = payload.id
JOIN payloadtype on payload.payload_type_id = payloadtype.id
WHERE callback.id=$1
`, dynamicQuery.Callback)
if err != nil {
return nil, err
}
dynamicQuery.PayloadUUID = callback.Payload.UuID
dynamicQuery.PayloadOS = callback.Payload.Os
dynamicQuery.PayloadType = callback.Payload.Payloadtype.Name
dynamicQuery.AgentCallbackID = callback.AgentCallbackID
dynamicQuery.CallbackDisplayID = callback.DisplayID
configBytes, err := json.Marshal(dynamicQuery)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func PayloadTypeDynamicQueryFunctionWebhook(c *gin.Context) {
FROM loadedcommands
JOIN command ON loadedcommands.command_id = command.id
JOIN payloadtype ON command.payload_type_id = payloadtype.id
WHERE callback_id = $1 AND command.cmd=$2`, input.Input.Callback, input.Input.Command)
WHERE callback_id = $1 AND command.cmd=$2 AND payloadtype.name=$3`, input.Input.Callback, input.Input.Command, input.Input.PayloadType)
if err != nil {
logging.LogError(err, "Failed to get command from loaded commands")
c.JSON(http.StatusOK, PayloadTypeDynamicQueryFunctionResponse{
Expand All @@ -75,7 +75,6 @@ func PayloadTypeDynamicQueryFunctionWebhook(c *gin.Context) {
Command: input.Input.Command,
CommandPayloadType: loadedCommand.Command.Payloadtype.Name,
ParameterName: input.Input.ParameterName,
PayloadType: input.Input.PayloadType,
Callback: input.Input.Callback,
Secrets: user.Secrets.StructValue(),
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func PayloadTypeDynamicTypedArrayParseWebhook(c *gin.Context) {
FROM loadedcommands
JOIN command ON loadedcommands.command_id = command.id
JOIN payloadtype ON command.payload_type_id = payloadtype.id
WHERE callback_id = $1 AND command.cmd=$2`, input.Input.Callback, input.Input.Command)
WHERE callback_id = $1 AND command.cmd=$2 AND payloadtype.name=$3`, input.Input.Callback, input.Input.Command, input.Input.PayloadType)
if err != nil {
logging.LogError(err, "Failed to get command from loaded commands")
c.JSON(http.StatusOK, PayloadTypeDynamicQueryFunctionResponse{
Expand All @@ -57,8 +57,8 @@ func PayloadTypeDynamicTypedArrayParseWebhook(c *gin.Context) {
if payloadtypeDynamicQueryResponse, err := rabbitmq.RabbitMQConnection.SendPtRPCTypedArrayParse(rabbitmq.PTRPCTypedArrayParseMessage{
Command: input.Input.Command,
ParameterName: input.Input.ParameterName,
CommandPayloadType: loadedCommand.Command.Payloadtype.Name,
PayloadType: input.Input.PayloadType,
CommandPayloadType: input.Input.PayloadType,
PayloadType: loadedCommand.Command.Payloadtype.Name,
Callback: input.Input.Callback,
InputArray: input.Input.InputArray,
}); err != nil {
Expand Down
6 changes: 3 additions & 3 deletions mythic-react-docker/mythic/public/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"files": {
"main.css": "/new/static/css/main.602591e6.css",
"main.js": "/new/static/js/main.e2a657e1.js",
"main.js": "/new/static/js/main.153cfd6c.js",
"static/media/mythic-red.png": "/new/static/media/mythic-red.203468a4e5240d239aa0.png",
"static/media/mythic_red_small.svg": "/new/static/media/mythic_red_small.793b41cc7135cdede246661ec232976b.svg",
"index.html": "/new/index.html",
"main.602591e6.css.map": "/new/static/css/main.602591e6.css.map",
"main.e2a657e1.js.map": "/new/static/js/main.e2a657e1.js.map"
"main.153cfd6c.js.map": "/new/static/js/main.153cfd6c.js.map"
},
"entrypoints": [
"static/css/main.602591e6.css",
"static/js/main.e2a657e1.js"
"static/js/main.153cfd6c.js"
]
}
2 changes: 1 addition & 1 deletion mythic-react-docker/mythic/public/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/new/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><link rel="apple-touch-icon" href="/new/logo192.png"/><link rel="manifest" href="/new/manifest.json"/><title>Mythic</title><script defer="defer" src="/new/static/js/main.e2a657e1.js"></script><link href="/new/static/css/main.602591e6.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/new/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><link rel="apple-touch-icon" href="/new/logo192.png"/><link rel="manifest" href="/new/manifest.json"/><title>Mythic</title><script defer="defer" src="/new/static/js/main.153cfd6c.js"></script><link href="/new/static/css/main.602591e6.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>

Large diffs are not rendered by default.

Large diffs are not rendered by default.

0 comments on commit 9cdd6c6

Please sign in to comment.