Skip to content

Commit

Permalink
adding new features and some slight ui fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
its-a-feature committed Nov 22, 2024
1 parent 8f7625c commit c8d6e9f
Show file tree
Hide file tree
Showing 41 changed files with 1,124 additions and 113 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ 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-rc26]

### Changed

- Updated the automated payload creation process to associate a task_id with the payload
- Execute a container's OnStart method after a file has been removed/edited/created via the UI
- Added new parameter to the create_go_tasking response, ReprocessAtNewCommandPayloadType
- this allows you to set the response.CommandName to some other command and response.ReprocessAtNewCommandPayloadType to the same or different payload type
- execution will then pass to that payload type's create_go_tasking for the new `CommandName` .
- This allows execution chains to happen for processing
- Added two more parameters to the MythicRPCCallbackAddCommand and MythicRPCCallbackRemoveCommand functions
- AgentCallbackID - allows you to add to callback based on AgentCallbackID (UUID) instead of by TaskID
- PayloadType - allows you to specify the payload type associated with the commands if they different than the payload type for the callback itself
- This is helpful for command augment containers that want to register additional augment commands
- Using the UI to add/remove/update files in a container will re-rigger the container's onStart function
- This allows containers to reprocess data as needed if it changes on disk

## [3.3.1-rc25] - 2024-11-18

### 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.59] - 2024-11-20

### Changed

- No longer need to refresh the page on updating your settings
- Added "payloads" search page
- Added commonFontFamily dropdown choice for people that want some common options when changing their preferences

## [0.2.58] - 2024-11-18

### Changed
Expand Down
4 changes: 2 additions & 2 deletions MythicReactUI/src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { Reporting } from './pages/Reporting/Reporting';
import { MitreAttack } from './pages/MITRE_ATTACK/MitreAttack';
import {Tags} from './pages/Tags/Tags';
import { Tooltip } from 'react-tooltip';
import {useQuery, useLazyQuery, gql } from '@apollo/client';
import {useLazyQuery, gql } from '@apollo/client';
//background-color: #282c34;
import { Route, Routes } from 'react-router-dom';
import { useInterval } from './utilities/Time';
Expand Down Expand Up @@ -125,7 +125,7 @@ export function App(props) {
fontFamily: preferences?.fontFamily
},
})),
[themeMode, loadingPreference]
[themeMode, loadingPreference, preferences.topColor, preferences.fontSize, preferences.fontFamily]
);
const mountedRef = React.useRef(true);
const [openRefreshDialog, setOpenRefreshDialog] = React.useState(false);
Expand Down
2 changes: 1 addition & 1 deletion MythicReactUI/src/components/TopAppBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ export function TopAppBar(props) {
function TopBarShortcuts({}){
return (
<>
<MythicStyledTooltip title="C2 Profiles and Payload Types" arrow >
<MythicStyledTooltip title="C2 Profiles and Payload Types" >
<IconButton component={Link} to='/new/payloadtypes'
color="inherit"
size="large" disableFocusRipple={true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ export function TopAppBarEventLogNotifications(props) {
color="error" max={99}
sx={{marginTop: "3px"}}
>
<NotificationsActiveTwoToneIcon fontSize={"large"} />
<NotificationsActiveTwoToneIcon fontSize={"large"}
style={{marginTop: "-3px"}}/>
</Badge>
)}
</IconButton>
Expand Down
8 changes: 5 additions & 3 deletions MythicReactUI/src/components/pages/Callbacks/Callbacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,14 @@ 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:"15px"}}
style={{ marginTop:"10px", marginRight: "20px"}}
direction='down'>
{actions.map((action) => (
<SpeedDialAction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {CallbacksTabsTaskMultipleDialog} from "./CallbacksTabsTaskMultipleDialog
import ip6 from 'ip6';
import {CallbacksContext, OnOpenTabContext, OnOpenTabsContext} from "./CallbacksTop";
import {useTheme} from '@mui/material/styles';
import {GetMythicSetting, SetMythicSetting, useSetMythicSetting} from "../../MythicComponents/MythicSavedUserSetting";
import {GetMythicSetting, useSetMythicSetting} from "../../MythicComponents/MythicSavedUserSetting";
import {DetailedCallbackTable} from "./DetailedCallbackTable";
import {ModifyCallbackMythicTreeGroupsDialog} from "./ModifyCallbackMythicTreeGroupsDialog";
import ClickAwayListener from '@mui/material/ClickAwayListener';
Expand Down
4 changes: 2 additions & 2 deletions MythicReactUI/src/components/pages/Eventing/Eventing.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,12 @@ export function Eventing({me}){
lineHeight: "30px"}} component="div">
Registered Event Groups
{showDeleted ? (
<MythicStyledTooltip title={"Hide Deleted Services"} style={{float: "right"}}>
<MythicStyledTooltip title={"Hide Deleted Services"} tooltipStyle={{float: "right"}}>
<IconButton size="small" style={{float: "right", }} variant="contained" onClick={() => setShowDeleted(!showDeleted)}><VisibilityIcon /></IconButton>
</MythicStyledTooltip>

) : (
<MythicStyledTooltip title={"Show Deleted Services"} style={{float: "right"}}>
<MythicStyledTooltip title={"Show Deleted Services"} tooltipStyle={{float: "right"}}>
<IconButton size="small" style={{float: "right", }} variant="contained" onClick={() => setShowDeleted(!showDeleted)} ><VisibilityOffIcon /></IconButton>
</MythicStyledTooltip>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {useTheme} from '@mui/material/styles';
import VisibilityOffIcon from '@mui/icons-material/VisibilityOff';
import VisibilityIcon from '@mui/icons-material/Visibility';
import { MythicStyledTooltip } from '../../MythicComponents/MythicStyledTooltip';
import { Backdrop, IconButton } from '@mui/material';
import { IconButton } from '@mui/material';
import MythicTableCell from "../../MythicComponents/MythicTableCell";
import {PayloadTypeRow} from "./PayloadTypeCard";
import {C2ProfilesRow} from "./C2ProfilesCard";
Expand Down Expand Up @@ -145,12 +145,12 @@ export function PayloadTypesC2Profiles({me}){
Payload / C2 Services
</Typography>
{showDeleted ? (
<MythicStyledTooltip title={"Hide Deleted Services"} style={{float: "right"}}>
<MythicStyledTooltip title={"Hide Deleted Services"} tooltipStyle={{float: "right"}}>
<IconButton size="small" style={{float: "right", marginTop: "5px"}} variant="contained" onClick={() => setShowDeleted(!showDeleted)}><VisibilityIcon /></IconButton>
</MythicStyledTooltip>

) : (
<MythicStyledTooltip title={"Show Deleted Services"} style={{float: "right"}}>
<MythicStyledTooltip title={"Show Deleted Services"} tooltipStyle={{float: "right"}}>
<IconButton size="small" style={{float: "right", marginTop: "5px"}} variant="contained" onClick={() => setShowDeleted(!showDeleted)} ><VisibilityOffIcon /></IconButton>
</MythicStyledTooltip>
)}
Expand Down
36 changes: 25 additions & 11 deletions MythicReactUI/src/components/pages/Payloads/Payloads.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { PayloadsTable } from './PayloadsTable';
import {useMutation, gql, useSubscription, useQuery, useLazyQuery} from '@apollo/client';
import { snackActions } from '../../utilities/Snackbar';

const payloadFragment = gql`
export const payloadFragment = gql`
fragment payloadData on payload {
build_message
build_phase
Expand All @@ -18,6 +18,9 @@ fragment payloadData on payload {
description
deleted
auto_generated
task {
display_id
}
payloadtype {
id
name
Expand Down Expand Up @@ -66,11 +69,11 @@ subscription SubPayloadsQuery($now: timestamp!) {
`;
const PayloadsQuery = gql`
${payloadFragment}
query PayloadsQuery($offset: Int!, $limit: Int!, $showDeleted: Boolean!) {
payload(order_by: {id: desc}, offset: $offset, limit: $limit, where: {_or: [{deleted: {_eq: false}}, {deleted: {_eq: $showDeleted}}]}) {
query PayloadsQuery($offset: Int!, $limit: Int!, $showDeleted: Boolean!, $showAutogenerated: Boolean!) {
payload(order_by: {id: desc}, offset: $offset, limit: $limit, where: {auto_generated: {_eq: $showAutogenerated}, _or: [{deleted: {_eq: false}}, {deleted: {_eq: $showDeleted}}]}) {
...payloadData
}
payload_aggregate(where: {_or: [{deleted: {_eq: false}}, {deleted: {_eq: $showDeleted}}]}) {
payload_aggregate(where: {auto_generated: {_eq: $showAutogenerated}, _or: [{deleted: {_eq: false}}, {deleted: {_eq: $showDeleted}}]}) {
aggregate {
count
}
Expand All @@ -87,15 +90,15 @@ mutation PayloadsDeletePayloadMutation($id: Int!) {
}
}
`;
const payloadsCallbackAlert = gql`
export const payloadsCallbackAlert = gql`
mutation PayloadsCallbackAlertMutation($id: Int!, $callback_alert: Boolean!) {
update_payload_by_pk(pk_columns: {id: $id}, _set: {callback_alert: $callback_alert}) {
id
callback_alert
}
}
`;
const restorePayloadMutation = gql`
export const restorePayloadMutation = gql`
mutation RestorePayloadToUndeleted($id: Int!){
update_payload_by_pk(pk_columns: {id: $id}, _set: {deleted: false}){
id
Expand All @@ -110,7 +113,8 @@ export function Payloads(props){
const [pageData, setPageData] = React.useState({
"totalCount": 0,
"fetchLimit": 20,
"showDeleted": false
"showDeleted": false,
"showAutogenerated": false,
});
const mountedRef = React.useRef(true);
useSubscription(SUB_Payloads, {
Expand Down Expand Up @@ -143,7 +147,7 @@ export function Payloads(props){
});

useQuery(PayloadsQuery, {
variables: {offset: 0, limit: pageData.fetchLimit, showDeleted: false},
variables: {offset: 0, limit: pageData.fetchLimit, showDeleted: false, showAutogenerated: false},
fetchPolicy: "no-cache",
onCompleted: (data) => {
let tempPageData = {...pageData};
Expand All @@ -168,8 +172,8 @@ export function Payloads(props){
}
})
const onChangePage = (event, value) => {
snackActions.info("Fetching page...")
fetchNewPage({variables: {offset: (value - 1) * pageData.fetchLimit, limit: pageData.fetchLimit, showDeleted: pageData.showDeleted}})
snackActions.info("Fetching page...");
fetchNewPage({variables: {offset: (value - 1) * pageData.fetchLimit, limit: pageData.fetchLimit, showDeleted: pageData.showDeleted, showAutogenerated: pageData.showAutogenerated}})
}
const [deletePayload] = useMutation(payloadsDelete, {
onCompleted: (data) => {
Expand Down Expand Up @@ -255,7 +259,16 @@ export function Payloads(props){
} else {
snackActions.info("Hiding deleted payloads...");
}
fetchNewPage({variables: {offset:0, limit: pageData.fetchLimit, showDeleted: showDeleted}})
fetchNewPage({variables: {offset:0, limit: pageData.fetchLimit, showDeleted: showDeleted, showAutogenerated: pageData.showAutogenerated}});
}
const onChangeShowAutogenerated = (showAutogenerated) => {
setPageData({...pageData, showAutogenerated: showAutogenerated});
if(showAutogenerated){
snackActions.info("Fetching auto generated payloads...");
} else {
snackActions.info("Hiding auto generated payloads...");
}
fetchNewPage({variables: {offset:0, limit: pageData.fetchLimit, showDeleted: pageData.showDeleted, showAutogenerated: showAutogenerated}});
}
React.useEffect( () => {
return() => {
Expand All @@ -272,6 +285,7 @@ export function Payloads(props){
onRestorePayload={onRestorePayload}
onChangePage={onChangePage}
onChangeShowDeleted={onChangeShowDeleted}
onChangeShowAutogenerated={onChangeShowAutogenerated}
/>
</div>

Expand Down
14 changes: 12 additions & 2 deletions MythicReactUI/src/components/pages/Payloads/PayloadsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ import {useNavigate} from 'react-router-dom';
import Pagination from '@mui/material/Pagination';


export function PayloadsTable({payload, onDeletePayload, onUpdateCallbackAlert, onRestorePayload, me, pageData, onChangePage, onChangeShowDeleted}){
export function PayloadsTable({payload, onDeletePayload, onUpdateCallbackAlert, onRestorePayload, me,
pageData, onChangePage, onChangeShowDeleted, onChangeShowAutogenerated}){
const theme = useTheme();
const [showDeleted, setShowDeleted] = React.useState(false);
const [showAutogenerated, setShowAutogenerated] = React.useState(false);
const [openPayloadImport, setOpenPayloadImport] = React.useState(false);
const dropdownAnchorRef = React.useRef(null);
const [dropdownOpen, setDropdownOpen] = React.useState(false);
Expand All @@ -34,6 +36,10 @@ export function PayloadsTable({payload, onDeletePayload, onUpdateCallbackAlert,
setShowDeleted(!showDeleted);
onChangeShowDeleted(!showDeleted);
}
const toggleShowAutogenerated = () => {
setShowAutogenerated(!showAutogenerated);
onChangeShowAutogenerated(!showAutogenerated);
}
const dropDownOptions = [
{
name: "Generate New Payload",
Expand All @@ -57,6 +63,10 @@ export function PayloadsTable({payload, onDeletePayload, onUpdateCallbackAlert,
name: showDeleted ? "Hide Deleted Payloads" : "Show Deleted Payloads",
click: toggleShowDeleted
},
{
name: showAutogenerated ? "Hide Autogenerated Payloads" : "Show Autogenerated Payloads",
click: toggleShowAutogenerated
}
]
const handleMenuItemClick = (event, index) => {
dropDownOptions[index].click();
Expand Down Expand Up @@ -117,7 +127,7 @@ export function PayloadsTable({payload, onDeletePayload, onUpdateCallbackAlert,
<TableCell style={{width: "2rem"}}></TableCell>
<TableCell style={{width: "6rem"}}></TableCell>
<TableCell>Progress</TableCell>
<TableCell style={{width: "5rem"}}>Download</TableCell>
<TableCell style={{width: "6rem"}}>Download</TableCell>
<TableCell>Tags</TableCell>
<TableCell>File</TableCell>
<TableCell>Description</TableCell>
Expand Down
12 changes: 11 additions & 1 deletion MythicReactUI/src/components/pages/Payloads/PayloadsTableRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import {PayloadGetSampleMessageDialog} from "./PayloadGetSampleMessageDialog";
import IosShareIcon from '@mui/icons-material/IosShare';
import {TagsDisplay, ViewEditTags} from "../../MythicComponents/MythicTag";
import {MythicAgentSVGIcon} from "../../MythicComponents/MythicAgentSVGIcon";
import SmartToyTwoToneIcon from '@mui/icons-material/SmartToyTwoTone';

const rebuildPayloadMutation = gql`
mutation triggerRebuildMutation($uuid: String!) {
Expand Down Expand Up @@ -305,7 +306,16 @@ 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>{b64DecodeUnicode(props.filemetum.filename_text)}</MythicStyledTableCell>
<MythicStyledTableCell>
{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"} >
<SmartToyTwoToneIcon />
</IconButton>
</MythicStyledTooltip>
}
{b64DecodeUnicode(props.filemetum.filename_text)}
</MythicStyledTableCell>
<MythicStyledTableCell>{props.description}</MythicStyledTableCell>
<MythicStyledTableCell>
<PayloadsTableRowC2Status payloadc2profiles={props.payloadc2profiles} uuid={props.uuid} />
Expand Down
Loading

0 comments on commit c8d6e9f

Please sign in to comment.