Skip to content

Commit

Permalink
UI QoL and proxy stop fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
its-a-feature committed Sep 27, 2024
1 parent a453392 commit 273f9a5
Show file tree
Hide file tree
Showing 25 changed files with 133 additions and 114 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ 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-rc15] - 2024-09-27

### Changed

- Updated the proxy stop through the UI to be more precise instead of stopping all proxies based on callback id, port, and port type
- It didn't account for variations in remote ip/port combinations

## [3.3.1-rc14] - 2024-09-25

### Changed

- Added some checks for port byte tracking max sizes and file max sizes to not hit postgres limits

## [3.3.1-rc12] - 2024-09-23

### Changed
Expand Down
9 changes: 9 additions & 0 deletions MythicReactUI/CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ 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.46] - 2024-09-27

### Changed

- Updated the default response fetch to 50 from 10 (still changeable in user settings)
- Truncating long command lines to 2 lines wrapped and the full text on hover after 2s
- Updated the copy command parameters speeddial function to also include the command name
- Updated a few of the text-based dialogs to use Ace editors instead of text boxes for more consistency

## [0.2.45] - 2024-09-23

### Changed
Expand Down
11 changes: 7 additions & 4 deletions MythicReactUI/src/components/MythicComponents/MythicDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,13 @@ export function MythicModifyStringDialog(props) {
return (
<React.Fragment>
<DialogTitle id="form-dialog-title">{props.title}</DialogTitle>
<DialogContent dividers={true} style={{height: "100%"}}>
<DialogContent dividers={true} style={{height: "100%", margin: 0, padding: 0}}>
<AceEditor
mode="json"
theme={theme.palette.mode === 'dark' ? 'monokai' : 'github'}
width="100%"
height="100%"
wrapEnabled={props.wrap ? props.wrap : false}
minLines={props.maxRows ? props.maxRows : 10}
maxLines={props.maxRows ? props.maxRows : 10}
value={comment}
Expand All @@ -98,9 +99,11 @@ export function MythicModifyStringDialog(props) {
<Button onClick={props.onClose} variant="contained" color="primary">
Close
</Button>
<Button onClick={onCommitSubmit} variant="contained" color="success">
Submit
</Button>
{props.onSubmit &&
<Button onClick={onCommitSubmit} variant="contained" color="success">
Submit
</Button>
}
</DialogActions>
</React.Fragment>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import { Tooltip } from '@mui/material';
import {useTheme} from '@mui/material/styles';

export function MythicStyledTooltip(props){
const { children, title, style, ...other} = props;
const { children, title, style, maxWidth, placement, enterDelay, ...other} = props;
const theme = useTheme();
return (
<Tooltip title={title} arrow followCursor enterDelay={750} componentsProps={{
<Tooltip title={title} arrow followCursor enterDelay={enterDelay ? enterDelay : 750}
placement={placement ? placement : "bottom"}
componentsProps={{
tooltip: {
sx: {
backgroundColor: theme.palette.background.contrast,
Expand All @@ -16,10 +18,11 @@ export function MythicStyledTooltip(props){
'& .MuiTooltip-arrow': {
color: theme.palette.background.contrast
},
zIndex: 1000
maxWidth: maxWidth ? maxWidth : "300px",
zIndex: 100000
}
}
}} style={{zIndex:1000}} {...other}>
}} style={{zIndex:100000}} {...other}>
{<span style={{display: "inline-block", ...style}}>{children}</span>}
</Tooltip>
);
Expand Down
11 changes: 7 additions & 4 deletions MythicReactUI/src/components/pages/Callbacks/Callbacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,18 +330,21 @@ function SpeedDialWrapperPreMemo({ setTopDisplay }) {
onOpen={() => {
setOpen(true);
}}
FabProps={{ color: 'info', size: "small", variant: "extended" }}
FabProps={{ color: 'info', size: "small", variant: "extended",
sx: {
height: "25px", minWidth: "unset", width: "25px"
} }}
open={open}
style={{ marginTop:"35px" }}
style={{ marginTop:"15px"}}
direction='down'>
{actions.map((action) => (
<SpeedDialAction
arrow
className={classes.speedDialAction}
key={action.name}
TooltipClasses={{ ".MuiTooltip-tooltip": classes.tooltip,
TooltipClasses={{
".MuiTooltip-tooltip": classes.tooltip,
".MuiTooltip-tooltipArrow": classes.arrow,

}}
icon={action.icon}
tooltipTitle={action.name}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ const GraphViewOptions = ({viewConfig, setViewConfig}) => {
};
return (
<div >
<ButtonGroup variant="contained" ref={dropdownAnchorRef} aria-label="split button" style={{marginTop: "10px"}} color="primary">
<ButtonGroup variant="contained" ref={dropdownAnchorRef} aria-label="split button" style={{marginTop: "0px", marginLeft: "25px"}} color="primary">
<Button size="small" color="primary" aria-controls={dropdownOpen ? 'split-button-menu' : undefined}
aria-expanded={dropdownOpen ? 'true' : undefined}
aria-haspopup="menu"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,7 @@ function CallbacksTablePreMemo(props){
{openEditDescriptionDialog &&
<MythicDialog
fullWidth={true}
maxWidth={"lg"}
open={openEditDescriptionDialog}
onClose={() => {setOpenEditDescriptionDialog(false);}}
innerDialog={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const NonInteractiveResponseDisplay = (props) => {
const search = React.useRef("");
const [totalCount, setTotalCount] = React.useState(0);
const [openBackdrop, setOpenBackdrop] = React.useState(true);
const initialResponseStreamLimit = useMythicSetting({setting_name: "experiment-responseStreamLimit", default_value: 10, output: "number"})
const initialResponseStreamLimit = useMythicSetting({setting_name: "experiment-responseStreamLimit", default_value: 50, output: "number"})
const [fetchMoreResponses] = useLazyQuery(getResponsesLazyQuery, {
fetchPolicy: "network-only",
onCompleted: (data) => {
Expand Down
21 changes: 7 additions & 14 deletions MythicReactUI/src/components/pages/Callbacks/TaskCommentDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import DialogTitle from '@mui/material/DialogTitle';
import MythicTextField from '../../MythicComponents/MythicTextField';
import {useQuery, gql, useMutation} from '@apollo/client';
import LinearProgress from '@mui/material/LinearProgress';
import {MythicModifyStringDialog} from "../../MythicComponents/MythicDialog";

const updateCommentMutation = gql`
mutation updateComment ($task_id: Int!, $comment: String) {
Expand Down Expand Up @@ -51,8 +52,8 @@ export function TaskCommentDialog(props) {
console.error(error);
return <div>Error!</div>;
}
const onCommitSubmit = () => {
updateComment({variables: {task_id: props.task_id, comment: comment}});
const onCommitSubmit = (newValue) => {
updateComment({variables: {task_id: props.task_id, comment: newValue}});
props.onClose();
}
const onChange = (name, value, error) => {
Expand All @@ -61,18 +62,10 @@ export function TaskCommentDialog(props) {

return (
<React.Fragment>
<DialogTitle id="form-dialog-title">Edit Task Comment</DialogTitle>
<DialogContent dividers={true}>
<MythicTextField autoFocus onEnter={onCommitSubmit} onChange={onChange} value={comment} />
</DialogContent>
<DialogActions>
<Button onClick={props.onClose} variant="contained" color="primary">
Close
</Button>
<Button onClick={onCommitSubmit} variant="contained" color="success">
Submit
</Button>
</DialogActions>
<MythicModifyStringDialog title={`Edit Task Comment`}
onClose={props.onClose}
value={comment}
onSubmit={onCommitSubmit} />
</React.Fragment>
);
}
Expand Down
26 changes: 17 additions & 9 deletions MythicReactUI/src/components/pages/Callbacks/TaskDisplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ export const StyledPaper = styled(Paper)((

[`& .${classes.heading}`]: {
fontSize: theme.typography.pxToRem(15),
display: "inline",
overflow: "hidden",
textOverflow: "ellipsis",
display: "-webkit-box",
WebkitLineClamp: "2",
WebkitBoxOrient: "vertical",
cursor: "default",
wordBreak: "break-all",
},
Expand Down Expand Up @@ -88,7 +92,6 @@ export const StyledPaper = styled(Paper)((
display: "block",
overflow: "auto",
maxWidth: "100%",
whiteSpace: "break-all",
wordBreak: "break-all",
},
[`& .${classes.icon}`]: {
Expand All @@ -104,7 +107,7 @@ export const StyledPaper = styled(Paper)((
padding: "0 5px 0 0",
display: "inline-block",
margin: 0,
height: "auto"
height: "auto",
}
}));

Expand Down Expand Up @@ -247,7 +250,7 @@ export const ColoredTaskLabel = ({task, theme, me, taskDivID, onClick, displayCh
if(onClick){
onClick(e);
}
preventPropagation(e);
//preventPropagation(e);
}

return (
Expand Down Expand Up @@ -315,8 +318,8 @@ export const ColoredTaskLabel = ({task, theme, me, taskDivID, onClick, displayCh
<TaskStatusDisplay task={task} theme={theme}/>
{task.comment.length > 0 ? (
<span className={classes.column}>
<IconButton size="small" style={{padding: "0"}} color="info"
onClick={toggleDisplayComment}><ChatOutlinedIcon/></IconButton>
<IconButton size="small" style={{padding: "0"}}
onClick={toggleDisplayComment}><ChatOutlinedIcon fontSize={"small"}/></IconButton>
</span>
) : null}
{task.comment}
Expand All @@ -333,9 +336,14 @@ export const ColoredTaskLabel = ({task, theme, me, taskDivID, onClick, displayCh
{task.tasks.length > 0 && displayChildren &&
<ExpandLessIcon onClick={toggleDisplayChildren} />
}
<Typography className={classes.heading} onClick={onLocalClick}>
{(task?.command?.cmd || task.command_name) + " " + task.display_params}
</Typography>
<MythicStyledTooltip maxWidth={"calc(80vw)"}
enterDelay={2000}
placement={"top"}
title={(task?.command?.cmd || task.command_name) + " " + task.display_params} >
<Typography className={classes.heading} onClick={onLocalClick} >
{(task?.command?.cmd || task.command_name) + " " + task.display_params}
</Typography>
</MythicStyledTooltip>
</Badge>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ export const TaskDisplayContainer = ({task, me}) => {
me={me}
responseRef={responseRef}
viewBrowserScript={viewBrowserScript}
style={{position: "relative", zIndex: 2, display: "flex", flexDirection: "row-reverse", width: '100%', bottom: "20px", right: "5px", height: 0}}
style={{position: "relative", zIndex: 2, display: "flex", flexDirection: "row-reverse", width: '100%',
bottom: "25px", right: "4px", height: 0}}
fabStyle={{ }}
viewAllOutput={selectAllOutput}/>
<Grid item xs={12}>
Expand Down Expand Up @@ -147,7 +148,7 @@ export const TaskDisplayContainerFlat = ({task, me}) => {
taskData={task}
viewBrowserScript={viewBrowserScript}
me={me} responseRef={responseRef}
style={{position: "absolute", bottom: 0, zIndex: 2}}
style={{position: "absolute", bottom: "15px", zIndex: 2}}
fabStyle={{ }}
viewAllOutput={selectAllOutput}/>
</div>
Expand Down Expand Up @@ -182,7 +183,7 @@ export const TaskDisplayContainerConsole = ({task, me}) => {
me={me}
viewBrowserScript={viewBrowserScript}
responseRef={responseRef}
style={{ bottom: "20px", right: "5px", zIndex: 2, height: "0px", position: "relative", display: "flex", flexDirection: "row-reverse"}}
style={{ bottom: "25px", right: "4px", zIndex: 2, height: "0px", position: "relative", display: "flex", flexDirection: "row-reverse"}}
fabStyle={{ }}
viewAllOutput={true}/>
<ResponseDisplayConsole
Expand Down Expand Up @@ -241,7 +242,8 @@ const SpeedDialDisplayGeneric = ({toggleViewBrowserScript, toggleSelectAllOutput
setOpenSpeedDial(false);
};
const copyToClipboard = () => {
let result = copyStringToClipboard(task.original_params);
let command = task?.command?.cmd || task.command_name;
let result = copyStringToClipboard(command + " " + task.original_params);
if(result){
snackActions.success("Copied text!");
}else{
Expand Down Expand Up @@ -308,18 +310,18 @@ const SpeedDialDisplayGeneric = ({toggleViewBrowserScript, toggleSelectAllOutput
<React.Fragment>
<Backdrop open={openSpeedDial} onClick={()=>{setOpenSpeedDial(false);}} style={{zIndex: 2, position: "absolute"}}/>
{openTaskTagDialog ?
(<MythicDialog fullWidth={true} maxWidth="md" open={openTaskTagDialog}
(<MythicDialog fullWidth={true} maxWidth="lg" open={openTaskTagDialog}
onClose={()=>{setOpenTaskTagDialog(false);}}
innerDialog={<ViewEditTagsDialog me={me} target_object={"task_id"} target_object_id={task.id} onClose={()=>{setOpenTaskTagDialog(false);}} />}
/>) : null}
{openCommentDialog ?
(<MythicDialog fullWidth={true} maxWidth="md" open={openCommentDialog}
(<MythicDialog fullWidth={true} maxWidth="lg" open={openCommentDialog}
onClose={()=>{setOpenCommentDialog(false);}}
innerDialog={<TaskCommentDialog task_id={task.id} onClose={()=>{setOpenCommentDialog(false);}} />}
/>) : null
}
{openParametersDialog ?
(<MythicDialog fullWidth={true} maxWidth="md" open={openParametersDialog}
(<MythicDialog fullWidth={true} maxWidth="lg" open={openParametersDialog}
onClose={()=>{setOpenParametersDialog(false);}}
innerDialog={<TaskViewParametersDialog task_id={task.id} onClose={()=>{setOpenParametersDialog(false);}} />}
/>) : null
Expand All @@ -338,7 +340,7 @@ const SpeedDialDisplayGeneric = ({toggleViewBrowserScript, toggleSelectAllOutput
}

{openStdoutStderrDialog ?
(<MythicDialog fullWidth={true} maxWidth="md" open={openStdoutStderrDialog}
(<MythicDialog fullWidth={true} maxWidth="lg" open={openStdoutStderrDialog}
onClose={()=>{setOpenStdoutStderrDialog(false);}}
innerDialog={<TaskViewStdoutStderrDialog task_id={task.id} onClose={()=>{setOpenStdoutStderrDialog(false);}} />}
/>) : null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export function TaskOpsecDialog(props) {
{(opsecData.opsec_pre_blocked === true && !opsecData.opsec_pre_bypassed) || (opsecData.opsec_post_blocked === true && !opsecData.opsec_post_bypassed) ?
(
<Button onClick={onRequestSubmit} variant="contained" color="warning">Submit Bypass Request</Button>
) : (null) }
) : null }

</DialogActions>
</React.Fragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'ace-builds/src-noconflict/theme-monokai';
import 'ace-builds/src-noconflict/theme-xcode';
import "ace-builds/src-noconflict/ext-searchbox";
import {useTheme} from '@mui/material/styles';
import {MythicModifyStringDialog} from "../../MythicComponents/MythicDialog";

const getParametersQuery = gql`
query getParametersQuery ($task_id: Int!) {
Expand Down Expand Up @@ -65,28 +66,11 @@ export function TaskViewParametersDialog(props) {
}
return (
<React.Fragment>
<DialogTitle id="form-dialog-title">View Task Parameters</DialogTitle>
<DialogContent dividers={true}>
<AceEditor
mode="json"
theme={theme.palette.mode === "dark" ? "monokai" : "xcode"}
fontSize={14}
showGutter={true}
highlightActiveLine={true}
value={comment}
focus={true}
width={"100%"}
setOptions={{
showLineNumbers: true,
useWorker: false,
tabSize: 4
}}/>
</DialogContent>
<DialogActions>
<Button onClick={props.onClose} variant="contained" color="primary">
Close
</Button>
</DialogActions>
<MythicModifyStringDialog title={`View Task Parameters`}
onClose={props.onClose}
maxRows={40}
wrap={true}
value={comment} />
</React.Fragment>
);
}
Expand Down
Loading

0 comments on commit 273f9a5

Please sign in to comment.