Skip to content

Commit

Permalink
ui fixes and proxy stop fix via MythicRPC
Browse files Browse the repository at this point in the history
added support for setting cli history to be display params vs original params per agent
  • Loading branch information
its-a-feature committed Oct 28, 2024
1 parent 641c8e1 commit 5979d23
Show file tree
Hide file tree
Showing 22 changed files with 148 additions and 82 deletions.
13 changes: 12 additions & 1 deletion MythicReactUI/CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ 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.51] - 2024-10-21

### Changed

- Updated the Callback/Payload add/remove command dialogs to not show deleted commands
- Added label for select options when no options are available in task modals
- Updating the file extension syntax checker to better identify known text files without extensions
- ex: Makefile, Dockerfile
- Added new field to user settings for showing display parameters or original parameters when doing an up/down arrow through cli history
- Added a check to re-sync payload types when a new wrapper payload type is registered

## [0.2.50] - 2024-10-16

### Changed
Expand Down Expand Up @@ -37,7 +48,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- Added ability to tab through ChooseOne parameter type values on the command line
-

## [0.2.46] - 2024-09-27

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ query GetCallbackDetails($callback_id: Int!) {
payload {
payloadtype {
name
commands {
commands(where: {deleted: {_eq: false}}) {
cmd
id
}
}
}
}
command(where: {payloadtype: {agent_type: {_eq: "command_augment"}}}){
command(where: {deleted: {_eq: false}, payloadtype: {agent_type: {_eq: "command_augment"}}}){
cmd
id
payloadtype {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { Backdrop } from '@mui/material';
import {CircularProgress} from '@mui/material';
import {getDynamicQueryParams} from "./TaskParametersDialogRow";
import {MythicAgentSVGIcon} from "../../MythicComponents/MythicAgentSVGIcon";
import {GetMythicSetting, SetMythicSetting} from "../../MythicComponents/MythicSavedUserSetting";

const GetLoadedCommandsSubscription = gql`
subscription GetLoadedCommandsSubscription($callback_id: Int!){
Expand Down Expand Up @@ -81,14 +82,21 @@ subscription tasksSubscription($callback_id: Int!){
}
payloadtype {
name
use_display_params_for_cli_history
}
}
}
}
`;

const GetUpDownArrowName = (task) => {
const GetUpDownArrowName = (task, useDisplayParamsForCLIHistoryUserSetting) => {
if(task.command){
if(task?.command?.payloadtype?.use_display_params_for_cli_history){
if(useDisplayParamsForCLIHistoryUserSetting){
return task.command.cmd + " " + task.display_params;
}
return task.command.cmd + " " + task.original_params;
}
return task.command.cmd + " " + task.original_params;
} else {
return task.command_name + " " + task.original_params;
Expand Down Expand Up @@ -219,6 +227,7 @@ export function CallbacksTabsTaskingInputPreMemo(props){
const commandOptionsForcePopup = React.useRef(false);
const [openSelectCommandDialog, setOpenSelectCommandDialog] = React.useState(false);
const me = useReactiveVar(meState);
const useDisplayParamsForCLIHistoryUserSetting = React.useRef(GetMythicSetting({setting_name: "useDisplayParamsForCLIHistory", default_value: "true"}));
const forwardOrBackwardTabIndex = (event, currentIndex, options) => {
if(event.shiftKey){
let newIndex = currentIndex - 1;
Expand Down Expand Up @@ -663,7 +672,7 @@ export function CallbacksTabsTaskingInputPreMemo(props){
newIndex = filteredTaskOptions.length -1;
}
taskOptionsIndex.current = newIndex;
setMessage(GetUpDownArrowName(filteredTaskOptions[newIndex]));
setMessage(GetUpDownArrowName(filteredTaskOptions[newIndex], useDisplayParamsForCLIHistoryUserSetting.current));
setUnmodifiedHistoryValue(filteredTaskOptions[newIndex].tasking_location);
setCommandPayloadType(filteredTaskOptions[newIndex]?.command?.payloadtype?.name || "");
}
Expand All @@ -677,7 +686,7 @@ export function CallbacksTabsTaskingInputPreMemo(props){
newIndex = 0;
}
taskOptionsIndex.current = newIndex;
setMessage(GetUpDownArrowName(filteredTaskOptions[newIndex]));
setMessage(GetUpDownArrowName(filteredTaskOptions[newIndex], useDisplayParamsForCLIHistoryUserSetting.current));
setUnmodifiedHistoryValue(filteredTaskOptions[newIndex].tasking_location);
setCommandPayloadType(filteredTaskOptions[newIndex]?.command?.payloadtype?.name || "");
}
Expand Down Expand Up @@ -1482,7 +1491,7 @@ export function CallbacksTabsTaskingInputPreMemo(props){
newIndex = reverseSearchOptions.current.length -1;
}
reverseSearchIndex.current = newIndex;
setMessage(GetUpDownArrowName(reverseSearchOptions.current[newIndex]));
setMessage(GetUpDownArrowName(reverseSearchOptions.current[newIndex], useDisplayParamsForCLIHistoryUserSetting.current));
setUnmodifiedHistoryValue(reverseSearchOptions.current[newIndex].tasking_location);
setCommandPayloadType(reverseSearchOptions.current[newIndex]?.command?.payloadtype?.name || "");
}
Expand All @@ -1498,7 +1507,7 @@ export function CallbacksTabsTaskingInputPreMemo(props){
newIndex = 0;
}
reverseSearchIndex.current = newIndex;
setMessage(GetUpDownArrowName(reverseSearchOptions.current[newIndex]));
setMessage(GetUpDownArrowName(reverseSearchOptions.current[newIndex], useDisplayParamsForCLIHistoryUserSetting.current));
setUnmodifiedHistoryValue(reverseSearchOptions.current[newIndex].tasking_location);
setCommandPayloadType(reverseSearchOptions.current[newIndex]?.command?.payloadtype?.name || "");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export const textExtensionTypes = ["txt", "ps1", "php", "json", "yml", "yaml", "
"html", "xml", "js", "java", "conf", "cs", "rb", "toml", "sh", "md", "ini", "py", "kirbi", "bash_profile", "rc",
"local", "gitconfig", "gitignore", "zsh_history", "bash_history", "ps", "psql_history", "lesshst", "gcloudignore",
"pem", "boto", "zsh_profile", "pub", "python_history", "sqlite_history", "viminfo", "zprofile", "zshrc",
"history", "historynew", "bashrc"
"history", "historynew", "bashrc",
];
export const textExtensionTypesToSyntax = {
"json": "json",
Expand All @@ -200,21 +200,26 @@ export const textExtensionTypesToSyntax = {
"php": "php",
"m": "objectivec",
"mm": "objectivec",
"Dockerfile": "dockerfile",
"Makefile": "makefile",
"dockerfile": "dockerfile",
"makefile": "makefile",
"sh": "sh",
"rc": "sh",
"bashrc": "sh",
"zshrc": "sh",
"zprofile": "sh",
"bash_profile": "sh",
"ini": "ini",
"conf": "apache_conf"
"conf": "apache_conf",
"bash_history": "sh",
"zsh_history": "sh",
"python_history": "python",
}
const knownTextFiles = ["config", "credentials", "known_hosts", "config_default", "id_rsa", "Dockerfile", "Makefile"];
const knownTextFiles = ["config", "credentials", "known_hosts", "config_default", "id_rsa", "dockerfile", "makefile"];
const imgExtensionTypes = ["png", "jpg", "gif", "jpeg", "pdf"];
const mimeType = (path) => {
if(!path){return undefined}
let extension = path.split(".");
if(extension.length > 0){
if(extension.length > 1){
extension = extension[extension.length - 1];
if(imgExtensionTypes.includes(extension.toLowerCase())){
return "object";
Expand Down Expand Up @@ -428,14 +433,14 @@ const DisplayText = ({agent_file_id, expand, filename, preview, fileMetaData}) =
}
if(filename){
let extension = filename.split(".");
if(extension.length > 0){
if(extension.length > 1){
extension = extension[extension.length - 1];
if(textExtensionTypesToSyntax[extension]){
setMode(textExtensionTypesToSyntax[extension]);
}
} else {
if(textExtensionTypesToSyntax[filename]){
setMode(textExtensionTypesToSyntax[filename]);
if(textExtensionTypesToSyntax[filename.toLowerCase()]){
setMode(textExtensionTypesToSyntax[filename.toLowerCase()]);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import TableBody from '@mui/material/TableBody';
import TableRow from '@mui/material/TableRow';
import FormControl from '@mui/material/FormControl';
import Select from '@mui/material/Select';
import InputLabel from '@mui/material/InputLabel';
import Switch from '@mui/material/Switch';
import Input from '@mui/material/Input';
import {Button, IconButton} from '@mui/material';
Expand Down Expand Up @@ -576,8 +577,12 @@ export function TaskParametersDialogRow(props){
<CircularProgress color="inherit" />
</Backdrop>
<FormControl style={{width: "100%"}}>
{ChoiceOptions.length === 0 &&
<InputLabel>{"No Options Available"}</InputLabel>
}
<Select
native
disabled={ChoiceOptions.length === 0}
autoFocus={props.autoFocus}
multiple={props.type === "ChooseMultiple"}
value={props.type === "ChooseMultiple" ? choiceMultipleValue : value}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ query getCommandsQuery($uuid: String!) {
}
id
}
command(where: {payloadtype: {payloads: {uuid: {_eq: $uuid}}}}) {
command(where: {deleted: {_eq: false}, payloadtype: {payloads: {uuid: {_eq: $uuid}}}}) {
cmd
id
}
Expand Down
Loading

0 comments on commit 5979d23

Please sign in to comment.