Skip to content

Commit

Permalink
adding stdout/stderr from tasks and ui fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
its-a-feature committed Feb 28, 2025
1 parent 71ca8d9 commit 5f9c160
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 17 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-rc47] - 2025-02-26

### Changed

- Updated task output to support `stdout` and `stderr` fields in addition to `user_output`

## [3.3.1-rc46] - 2025-02-21

### 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.3.14] - 2025-02-26

### Changed

- Updated file preview for 'text' to properly show extra characters
- Updated payloads table description to break words
- Fixed the rendering for multiple tables in a single output

## [0.3.13] - 2025-02-21

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ const DisplayText = ({agent_file_id, expand, filename, preview, fileMetaData}) =
const [previewFileString] = useMutation(previewFileQuery, {
onCompleted: (data) => {
if(data.previewFile.status === "success"){
setContent(atob(data.previewFile.contents));
setContent(b64DecodeUnicode(data.previewFile.contents));
if(data.previewFile.size > 512000){
setLimitedPreviewWarning(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -633,12 +633,15 @@ export const ResponseDisplayTable = ({table, callback_id, expand, task}) =>{
}, [table.rows])
const sortColumn = table.headers.findIndex((column) => column.plaintext === sortData.sortKey);
const tableStyle = React.useMemo( () => {
return expand ? {flexGrow: 1, width: "99%", position: "relative"} : {height: dataHeight, position: "relative"}
return expand ? {flexGrow: 1,
minHeight: gridData.length > 0 ? Math.min(maxHeight, dataHeight) : 0,
width: "99%", position: "relative"} :
{height: dataHeight, position: "relative"}
}, [expand, dataHeight]);
return (
<div style={{height: "100%", display: "flex", flexDirection: "column", position: "relative", width: "100%"}}>
{table?.title ? (
<Paper elevation={5} style={{backgroundColor: theme.pageHeader.main, color: theme.pageHeaderText.main, marginBottom: "5px", marginTop: "10px"}} variant={"elevation"}>
<Paper elevation={5} style={{backgroundColor: theme.pageHeader.main, color: theme.pageHeaderText.main, marginBottom: "5px"}} variant={"elevation"}>
<Typography variant="h5" style={{textAlign: "left", display: "inline-block", marginLeft: "20px"}}>
{table.title}
</Typography>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ export function PayloadsTableRow(props){
<ViewEditTags target_object={"filemeta_id"} target_object_id={props.filemetum.id} me={props.me} />
<TagsDisplay tags={props.filemetum.tags} />
</MythicStyledTableCell>
<MythicStyledTableCell>
<MythicStyledTableCell style={{wordBreak: "break-all"}}>
{props.auto_generated && props.task &&
<MythicStyledTooltip title={"This payload was auto generated by a task"} >
<IconButton href={"/new/task/" + props?.task?.display_id} target={"_blank"} >
Expand All @@ -319,7 +319,7 @@ export function PayloadsTableRow(props){
}
{b64DecodeUnicode(props.filemetum.filename_text)}
</MythicStyledTableCell>
<MythicStyledTableCell>{props.description}</MythicStyledTableCell>
<MythicStyledTableCell style={{wordBreak: "break-all"}}>{props.description}</MythicStyledTableCell>
<MythicStyledTableCell>
<PayloadsTableRowC2Status payloadc2profiles={props.payloadc2profiles} uuid={props.uuid} />
</MythicStyledTableCell>
Expand Down
2 changes: 1 addition & 1 deletion MythicReactUI/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import jwt_decode from 'jwt-decode';
import {meState} from './cache';
import {getSkewedNow} from "./components/utilities/Time";

export const mythicUIVersion = "0.3.13";
export const mythicUIVersion = "0.3.14";

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-rc46
3.3.1-rc47
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-rc46
3.3.1-rc47
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ type agentMessagePostResponse struct {
Completed *bool `json:"completed,omitempty" mapstructure:"completed,omitempty" xml:"completed,omitempty"`
UserOutput *string `json:"user_output,omitempty" mapstructure:"user_output,omitempty" xml:"user_output,omitempty"`
Status *string `json:"status,omitempty" mapstructure:"status,omitempty" xml:"status,omitempty"`
Stdout *string `json:"stdout,omitempty" mapstructure:"stdout,omitempty" xml:"stdout,omitempty"`
Stderr *string `json:"stderr,omitempty" mapstructure:"stderr,omitempty" xml:"stderr,omitempty"`
FileBrowser *agentMessagePostResponseFileBrowser `json:"file_browser,omitempty" mapstructure:"file_browser,omitempty" xml:"file_browser,omitempty"`
RemovedFiles *[]agentMessagePostResponseRemovedFiles `json:"removed_files,omitempty" mapstructure:"removed_files,omitempty" xml:"removed_files,omitempty"`
Credentials *[]agentMessagePostResponseCredentials `json:"credentials,omitempty" mapstructure:"credentials,omitempty" xml:"credentials,omitempty"`
Expand Down Expand Up @@ -333,6 +335,7 @@ func handleAgentMessagePostResponse(incoming *map[string]interface{}, uUIDInfo *
} else {
err = database.DB.Get(&currentTask, `SELECT
task.id, task.status, task.completed, task.status_timestamp_processed, task.operator_id, task.operation_id,
task.stdout, task.stderr,
task.eventstepinstance_id, task.apitokens_id,
callback.host "callback.host",
callback.user "callback.user",
Expand Down Expand Up @@ -430,6 +433,12 @@ func handleAgentMessagePostResponse(incoming *map[string]interface{}, uUIDInfo *
SequenceNum: agentMessage.Responses[i].SequenceNumber,
}
}
if agentMessage.Responses[i].Stdout != nil {
currentTask.Stdout += *agentMessage.Responses[i].Stdout
}
if agentMessage.Responses[i].Stderr != nil {
currentTask.Stderr = *agentMessage.Responses[i].Stderr
}
if agentMessage.Responses[i].FileBrowser != nil {
// do it in the background - the agent doesn't need the result of this directly
go HandleAgentMessagePostResponseFileBrowser(currentTask, agentMessage.Responses[i].FileBrowser, 0)
Expand Down Expand Up @@ -485,7 +494,8 @@ func handleAgentMessagePostResponse(incoming *map[string]interface{}, uUIDInfo *
for _, currentTask := range cachedTaskData {
// always updating at least the timestamp for the last thing that happened
_, err = database.DB.NamedExec(`UPDATE task SET
status=:status, completed=:completed, status_timestamp_processed=:status_timestamp_processed, "timestamp"=:timestamp
status=:status, completed=:completed, status_timestamp_processed=:status_timestamp_processed, "timestamp"=:timestamp,
stdout=:stdout, stderr=:stderr
WHERE id=:id`, currentTask)
if err != nil {
logging.LogError(err, "Failed to update task from agent response")
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,17 +1,17 @@
{
"files": {
"main.css": "/new/static/css/main.602591e6.css",
"main.js": "/new/static/js/main.d79cea76.js",
"main.js": "/new/static/js/main.7f18fd93.js",
"static/media/mythic-red.png": "/new/static/media/mythic-red.203468a4e5240d239aa0.png",
"static/media/graphql.png": "/new/static/media/graphql.8f15978b39b0870a9f0e.png",
"static/media/Mythic_Logo.svg": "/new/static/media/Mythic_Logo.6842c911bebe36d6f83fc7ced4a2cd99.svg",
"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.d79cea76.js.map": "/new/static/js/main.d79cea76.js.map"
"main.7f18fd93.js.map": "/new/static/js/main.7f18fd93.js.map"
},
"entrypoints": [
"static/css/main.602591e6.css",
"static/js/main.d79cea76.js"
"static/js/main.7f18fd93.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.d79cea76.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.7f18fd93.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 5f9c160

Please sign in to comment.