Skip to content

Commit

Permalink
UI tweaks and timeskew updates, server fixes for automation and search
Browse files Browse the repository at this point in the history
  • Loading branch information
its-a-feature committed Mar 7, 2025
1 parent 340ecb1 commit e68be38
Show file tree
Hide file tree
Showing 20 changed files with 111 additions and 66 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ 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-rc50] - 2025-03-07

### Changed

- Updated the FileSearch to not implicitly check for files with comments
- Fixed an issue with task automation not properly returning the display_id for tasks

## [3.3.1-rc49] - 2025-03-05

### 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.16] - 2025-03-07

### Changed

- Updated all dropdown menus for tasking to be MenuItem and not Native formatted
- Updated dropdown fields for tasking to register newlines
- Fixes for timeskew calculations

## [0.3.15] - 2025-03-04

### Changed
Expand Down
13 changes: 7 additions & 6 deletions MythicReactUI/src/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,9 @@ export const mePreferences = makeVar(operatorSettingDefaults);
export const successfulLogin = (data) => {
localStorage.setItem("access_token", data.access_token);
localStorage.setItem("refresh_token", data.refresh_token);


let now = new Date();
let serverNow = new Date(data.user.current_utc_time);
const difference = (serverNow.getTime() - now.getTime()) / 1000;
const difference = (serverNow.getTime() - now.getTime());
let me = {...data.user};
me.server_skew = difference;
me.login_time = now;
Expand All @@ -139,7 +137,7 @@ export const successfulRefresh = (data) => {
localStorage.setItem("refresh_token", data.refresh_token);
let now = new Date();
let serverNow = new Date(data.user.current_utc_time);
const difference = (serverNow.getTime() - now.getTime()) / 1000;
const difference = (serverNow.getTime() - now.getTime()) ;
let me = {...meState().user};
me.server_skew = difference;
me.login_time = now;
Expand All @@ -153,7 +151,7 @@ export const successfulRefresh = (data) => {
});
localStorage.setItem("user", JSON.stringify(me));
}
export const FailedRefresh = () =>{
export const FailedRefresh = (restart_websockets) =>{
console.log("failed refresh");
localStorage.removeItem("access_token");
localStorage.removeItem("refresh_token");
Expand All @@ -172,6 +170,9 @@ export const FailedRefresh = () =>{
});
mePreferences(operatorSettingDefaults);
snackActions.clearAll();
restartWebsockets();
if(restart_websockets){
restartWebsockets();
}

}

2 changes: 1 addition & 1 deletion MythicReactUI/src/components/TopAppBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ function TopBarRightShortcuts({me, toggleTheme, serverName}){
const [openFeedbackForm, setOpenFeedbackForm] = React.useState(false);
const handleLogout = () => {
menuOpen(false);
FailedRefresh();
FailedRefresh(true);
}
const handleMenu = (event) => {
setAnchorEl(event.currentTarget);
Expand Down
2 changes: 1 addition & 1 deletion MythicReactUI/src/components/TopAppBarVertical.js
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ function TopBarRightShortcutsVertical({me, isOpen, serverName}){
const [openFeedbackForm, setOpenFeedbackForm] = React.useState(false);
const handleLogout = () => {
menuOpen(false);
FailedRefresh();
FailedRefresh(true);
}
const handleSettingsMenu = (event) => {
settingsRef.current = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ export const CallbacksTableLastCheckinCell = React.memo( ({rowData, cellData, me
if(newTime === "a few seconds"){
moment.relativeTimeThreshold('s', 60);
moment.relativeTimeThreshold('ss', 0);
return moment(rowData.last_checkin + "Z", "YYYY-MM-DDTHH:mm:ss.SSSSSSZ").subtract(me?.user?.server_skew || 0, 'second').fromNow(true)
return moment(rowData.last_checkin + "Z", "YYYY-MM-DDTHH:mm:ss.SSSSSSZ").subtract(me?.user?.server_skew || 0, 'millisecond').fromNow(true)
}
return moment(rowData.last_checkin + "Z", "YYYY-MM-DDTHH:mm:ss.SSSSSSZ").subtract(me?.user?.server_skew || 0, 'second').fromNow(true);
return moment(rowData.last_checkin + "Z", "YYYY-MM-DDTHH:mm:ss.SSSSSSZ").subtract(me?.user?.server_skew || 0, 'millisecond').fromNow(true);
//return newTime;
}
const theme = useTheme();
Expand Down
14 changes: 7 additions & 7 deletions MythicReactUI/src/components/pages/Callbacks/ResponseDisplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,35 +551,35 @@ const ResponseDisplayComponent = ({rawResponses, viewBrowserScript, output, comm
{browserScriptData?.screenshot?.map( (scr, index) => (
<ResponseDisplayScreenshot key={"screenshot" + index + 'fortask' + task.id} task={task} {...scr}
displayType={displayType} expand={expand} />
)) || null
))
}
{browserScriptData?.plaintext !== undefined &&
<ResponseDisplayPlaintext plaintext={browserScriptData["plaintext"]} task={task}
expand={expand} displayType={displayType} />
}
{browserScriptData?.table?.map( (table, index) => {
{browserScriptData?.table?.map( (table, index) => (

return <ResponseDisplayTable callback_id={task.callback_id} task={task} expand={expand}
<ResponseDisplayTable callback_id={task.callback_id} task={task} expand={expand}
table={table} key={"tablefortask" + task.id + "table" + index}
displayType={displayType}
/>
}) || null
))
}
{browserScriptData?.download?.map( (dl, index) => (
<ResponseDisplayDownload download={dl} task={task} displayType={displayType}
key={"download" + index + "fortask" + task.id} />
)) || null
))
}
{browserScriptData?.search?.map( (s, index) => (
<ResponseDisplaySearch search={s} task={task} displayType={displayType}
key={"searchlink" + index + "fortask" + task.id} />
)) || null
))
}
{browserScriptData?.media?.map( (s, index) => (
<ResponseDisplayMedia key={"searchmedia" + index + "fortask" + task.id}
displayType={displayType}
task={task} media={s} expand={expand} />
)) || null}
))}
{browserScriptData?.graph !== undefined &&
<ResponseDisplayGraph graph={browserScriptData.graph} task={task}
expand={expand} displayType={displayType} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,9 @@ export function TaskParametersDialogRow(props){
props.onChange(props.name, {...props.choices[props.choices.length-1]}, false);
updateToLatestCredential.current = false;
}
if(value === ""){
setValue(0);
}
}
if(props.dynamic_query_function === null && value===""){
setChoiceOptions([...props.choices]);
Expand Down Expand Up @@ -588,7 +591,11 @@ export function TaskParametersDialogRow(props){
>
{
ChoiceOptions.map((opt, i) => (
<MenuItem key={props.name + i} value={opt}>{opt}</MenuItem>
<MenuItem key={props.name + i} value={opt}>
<Typography style={{wordBreak: "break-all", whiteSpace: "pre-wrap"}}>
{opt}
</Typography>
</MenuItem>
))
}
</Select>
Expand All @@ -614,7 +621,6 @@ export function TaskParametersDialogRow(props){
<InputLabel>{"No Options Available"}</InputLabel>
}
<Select
native
disabled={ChoiceOptions.length === 0}
autoFocus={props.autoFocus}
multiple={props.type === "ChooseMultiple"}
Expand All @@ -624,7 +630,11 @@ export function TaskParametersDialogRow(props){
>
{
ChoiceOptions.map((opt, i) => (
<option key={props.name + i} value={opt}>{opt}</option>
<MenuItem key={props.name + i} value={opt}>
<Typography style={{wordBreak: "break-all", whiteSpace: "pre-wrap"}}>
{opt}
</Typography>
</MenuItem>
))
}
</Select>
Expand Down Expand Up @@ -785,15 +795,18 @@ export function TaskParametersDialogRow(props){
return (
<FormControl style={{width: "100%"}}>
<Select
native
value={value}
autoFocus={props.autoFocus}
onChange={(evt) => {onChangeLinkInfo(evt.target.value)}}
input={<Input />}
>
{
props.choices.map((opt, i) => (
<option key={props.name + i} value={i}>{opt.display}</option>
<MenuItem key={props.name + i} value={i}>
<Typography style={{wordBreak: "break-all", whiteSpace: "pre-wrap"}}>
{opt.display}
</Typography>
</MenuItem>
))
}
</Select>
Expand All @@ -803,16 +816,18 @@ export function TaskParametersDialogRow(props){
return (
<FormControl style={{width: "100%"}}>
<Select
native
value={value}

autoFocus={props.autoFocus}
onChange={onChangeValue}
input={<Input />}
>
{
props.choices.map((opt, i) => (
<option key={props.name + i} value={opt.uuid}>{opt.display}</option>
<MenuItem key={props.name + i} value={opt.uuid}>
<Typography style={{wordBreak: "break-all", whiteSpace: "pre-wrap"}}>
{opt.display}
</Typography>
</MenuItem>
))
}
</Select>
Expand All @@ -837,16 +852,19 @@ export function TaskParametersDialogRow(props){
<MythicStyledTableCell>
<FormControl style={{width: "100%"}}>
<Select
native
value={agentConnectNewPayload}
onChange={onChangeAgentConnectNewPayload}
input={<Input />}
>
{props.payload_choices ? (
props.payload_choices.map((opt, i) => (
<option key={props.name + "newpayload" + i} value={i}>{opt.display}</option>
<MenuItem key={props.name + "newpayload" + i} value={i}>
<Typography style={{wordBreak: "break-all", whiteSpace: "pre-wrap"}}>
{opt.display}
</Typography>
</MenuItem>
))
) : ( <option key={props.name + "nooptionnewpayload"} value="-1">No Payloads</option> )}
) : ( <MenuItem key={props.name + "nooptionnewpayload"} value="-1">No Payloads</MenuItem> )}
</Select>
</FormControl>
</MythicStyledTableCell>
Expand All @@ -871,14 +889,13 @@ export function TaskParametersDialogRow(props){
<MythicStyledTableCell>
<FormControl style={{width: "100%"}}>
<Select
native
value={agentConnectHost}
onChange={onChangeAgentConnectHost}
input={<Input />}
>
{
agentConnectHostOptions.map((opt, i) => (
<option key={props.name + "connecthost" + i} value={i}>{opt.host}</option>
<MenuItem key={props.name + "connecthost" + i} value={i}>{opt.host}</MenuItem>
))
}
</Select>
Expand All @@ -890,14 +907,17 @@ export function TaskParametersDialogRow(props){
<MythicStyledTableCell>
<FormControl style={{width: "100%"}}>
<Select
native
value={agentConnectPayload}
onChange={onChangeAgentConnectPayload}
input={<Input />}
>
{
agentConnectPayloadOptions.map((opt, i) => (
<option key={props.name + "connectagent" + i} value={i}>{opt.display}</option>
<MenuItem key={props.name + "connectagent" + i} value={i}>
<Typography style={{wordBreak: "break-all", whiteSpace: "pre-wrap"}}>
{opt.display}
</Typography>
</MenuItem>
))
}
</Select>
Expand Down Expand Up @@ -927,14 +947,13 @@ export function TaskParametersDialogRow(props){
<MythicStyledTableCell>
<FormControl style={{width: "100%"}}>
<Select
native
value={agentConnectC2Profile}
onChange={onChangeAgentConnectC2Profile}
input={<Input />}
>
{
agentConnectC2ProfileOptions.map((opt, i) => (
<option key={props.name + "connectprofile" + i} value={i}>{opt.name}</option>
<MenuItem key={props.name + "connectprofile" + i} value={i}>{opt.name}</MenuItem>
))
}
</Select>
Expand Down Expand Up @@ -973,17 +992,21 @@ export function TaskParametersDialogRow(props){
/>
<FormControl style={{width: "100%"}}>
<Select
native
value={value}
autoFocus={props.autoFocus}
onChange={onChangeCredentialJSONValue}
input={<Input />}
>
{
ChoiceOptions.map((opt, i) => (
<option key={props.name + i} value={i}>
{opt.account + "@" + opt.realm + " - " + opt.credential_text.substring(0, 10) + " - " + opt.comment}
</option>
<MenuItem key={props.name + i} value={i}>
<Typography style={{wordBreak: "break-all", whiteSpace: "pre-wrap"}}>
{opt.account + (opt.realm === "" ? "" : "@" + opt.realm) + " - " +
(opt.credential_text.length > 40 ? opt.credential_text.substring(0, 40) + "..." : opt.credential_text) +
(opt.comment.length > 0 ? "\n" + opt.comment : "")}
</Typography>

</MenuItem>
))
}
</Select>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,12 +400,11 @@ export function CreatePayloadParameter({onChange, parameter_type, default_value,
<Select
value={multiValue}
multiple={true}
native
onChange={onChangeMultValue}
>
{
chooseOptions.map((opt, i) => (
<option key={"buildparamopt" + i} value={opt}>{opt}</option>
<MenuItem key={"buildparamopt" + i} value={opt}>{opt}</MenuItem>
))
}
</Select>
Expand Down Expand Up @@ -455,7 +454,6 @@ export function CreatePayloadParameter({onChange, parameter_type, default_value,
<div style={{display: "inline-flex", alignItems: "center", width: "100%"}}>
<FormControl style={{width: "30%"}}>
<Select

value={a[0]}
onChange={(e) => onChangeTypedArrayChoice(e, i)}
input={<Input />}
Expand Down
Loading

0 comments on commit e68be38

Please sign in to comment.