Skip to content

Commit fef7336

Browse files
committed
file browser and media display tweaks
1 parent 5c17b50 commit fef7336

11 files changed

+71
-20
lines changed

MythicReactUI/CHANGELOG.MD

+7
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [0.2.38] - 2024-08-29
8+
9+
### Changed
10+
11+
- Adjusted the file browser a bit to auto close folders with no data in them
12+
- Adjusted the media render view to indicate if chunks are missing
13+
714
## [0.2.36-37] - 2024-08-28
815

916
### Changed

MythicReactUI/src/components/pages/Callbacks/CallbacksTabsFileBrowser.js

+17-7
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,13 @@ export const CallbacksTabsFileBrowserPanel = ({ index, value, tabInfo, me }) =>
244244
// new host discovered
245245
treeRootDataRef.current[currentGroups[j]][data.mythictree[i]["host"]] = {};
246246
}
247-
treeRootDataRef.current[currentGroups[j]][data.mythictree[i]["host"]][data.mythictree[i]["full_path_text"]] = {...data.mythictree[i]}
247+
if(treeRootDataRef.current[currentGroups[j]][data.mythictree[i]["host"]][data.mythictree[i]["full_path_text"]] === undefined){
248+
treeRootDataRef.current[currentGroups[j]][data.mythictree[i]["host"]][data.mythictree[i]["full_path_text"]] = {...data.mythictree[i]};
249+
} else {
250+
if(treeRootDataRef.current[currentGroups[j]][data.mythictree[i]["host"]][data.mythictree[i]["full_path_text"]].success === null){
251+
treeRootDataRef.current[currentGroups[j]][data.mythictree[i]["host"]][data.mythictree[i]["full_path_text"]] = {...data.mythictree[i]}
252+
}
253+
}
248254
}
249255
}
250256
// create the top level data in the adjacency matrix
@@ -300,7 +306,7 @@ export const CallbacksTabsFileBrowserPanel = ({ index, value, tabInfo, me }) =>
300306
if(selectedFolderData.group === currentGroups[j] && selectedFolderData.host === data.data.mythictree_stream[i]["host"] &&
301307
selectedFolderData.full_path_text === data.data.mythictree_stream[i]["full_path_text"]){
302308
setSelectedFolderData({...treeRootDataRef.current[currentGroups[j]][data.data.mythictree_stream[i]["host"]][data.data.mythictree_stream[i]["full_path_text"]],
303-
group: currentGroups[j]});
309+
group: currentGroups[j], fromHistory: selectedFolderData.fromHistory});
304310
}
305311
} else {
306312
// we need to merge data in because we already have some info
@@ -319,10 +325,11 @@ export const CallbacksTabsFileBrowserPanel = ({ index, value, tabInfo, me }) =>
319325
return {...f, filename_text: b64DecodeUnicode(f.filename_text)};
320326
})
321327
existingData.filemeta = [...existingData.filemeta, ...newfileData]
328+
322329
treeRootDataRef.current[currentGroups[j]][data.data.mythictree_stream[i]["host"]][data.data.mythictree_stream[i]["full_path_text"]] = {...existingData};
323330
if(selectedFolderData.group === currentGroups[j] && selectedFolderData.host === data.data.mythictree_stream[i]["host"] &&
324331
selectedFolderData.full_path_text === data.data.mythictree_stream[i]["full_path_text"]){
325-
setSelectedFolderData({...existingData, group: currentGroups[j]});
332+
setSelectedFolderData({...existingData, group: currentGroups[j], fromHistory: selectedFolderData.fromHistory});
326333
}
327334
}
328335
}
@@ -391,7 +398,7 @@ export const CallbacksTabsFileBrowserPanel = ({ index, value, tabInfo, me }) =>
391398
if(selectedFolderData.group === currentGroups[j] && selectedFolderData.host === mythictree[i]["host"] &&
392399
selectedFolderData.full_path_text === mythictree[i]["full_path_text"]){
393400
setSelectedFolderData({...treeRootDataRef.current[currentGroups[j]][mythictree[i]["host"]][mythictree[i]["full_path_text"]],
394-
group: currentGroups[j]});
401+
group: currentGroups[j], fromHistory: selectedFolderData.fromHistory});
395402
}
396403
} else {
397404
// we need to merge data in because we already have some info
@@ -413,7 +420,9 @@ export const CallbacksTabsFileBrowserPanel = ({ index, value, tabInfo, me }) =>
413420
treeRootDataRef.current[currentGroups[j]][mythictree[i]["host"]][mythictree[i]["full_path_text"]] = {...existingData};
414421
if(selectedFolderData.group === currentGroups[j] && selectedFolderData.host === mythictree[i]["host"] &&
415422
selectedFolderData.full_path_text === mythictree[i]["full_path_text"]){
416-
setSelectedFolderData({...existingData, group: currentGroups[j]});
423+
setSelectedFolderData({...existingData,
424+
group: currentGroups[j],
425+
fromHistory: selectedFolderData.fromHistory});
417426
}
418427
}
419428
}
@@ -483,7 +492,7 @@ export const CallbacksTabsFileBrowserPanel = ({ index, value, tabInfo, me }) =>
483492
host: parentData.host,
484493
full_path_text: parentData.full_path_text
485494
};
486-
setSelectedFolderData(parentData);
495+
setSelectedFolderData({...parentData, fromHistory: false});
487496
};
488497
const localSelectedToken = React.useRef("");
489498
const onChangeSelectedToken = (token) => {
@@ -736,7 +745,7 @@ const FileBrowserTableTop = ({
736745
return;
737746
}
738747
if(selectedFolderData.id !== ""){
739-
if(history[0]?.id !== selectedFolderData.id){
748+
if(history[0]?.full_path_text !== selectedFolderData.full_path_text){
740749
// always add newest things to the bottom of the stack
741750
setHistory([selectedFolderData, ...history]);
742751
if(history.length > 20){
@@ -756,6 +765,7 @@ const FileBrowserTableTop = ({
756765
}
757766
const moveIndexToNextListing = () => {
758767
// we're getting close to index 0, the newest listing
768+
console.log(historyIndex, history);
759769
if(historyIndex <= 0){
760770
return
761771
}

MythicReactUI/src/components/pages/Callbacks/CallbacksTabsFileBrowserTable.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -940,8 +940,10 @@ const FileBrowserTableRowActionCell = ({ rowData, cellData, onTaskRowAction, tre
940940
<SettingsIcon />
941941
</IconButton>
942942
{treeRootData[selectedFolderData.host][cellData]?.filemeta.length > 0 ?
943-
<MythicStyledTooltip title={"Preview Media"}>
944-
<FontAwesomeIcon icon={faPhotoVideo} style={{height: "15px", marginRight: "5px", position: "relative", cursor: "pointer", display: "inline-block"}}
943+
<MythicStyledTooltip title={treeRootData[selectedFolderData.host][cellData]?.filemeta[0]?.complete ?
944+
"Preview Media" : "Preview Partial Media"}>
945+
<FontAwesomeIcon icon={faPhotoVideo} style={{height: "15px", marginRight: "5px",
946+
position: "relative", cursor: "pointer", display: "inline-block"}}
945947
onClick={openFilePreview}/>
946948
</MythicStyledTooltip>
947949

MythicReactUI/src/components/pages/Callbacks/CallbacksTabsFileBrowserTree.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,21 @@ export const CallbacksTabsFileBrowserTreePreMemo = ({ treeRootData, treeAdjMatri
1414
const [openNodes, setOpenNodes] = React.useState({});
1515
const groupName = React.useRef("");
1616
const [openViewGroupsDialog, setOpenViewGroupDialog] = React.useState(false);
17+
const lastOpenedNodeRef = React.useRef({group: "", host: "", full_path_text: ""});
1718
const toggleNodeExpanded = (nodeId, nodeData) => {
1819
//console.log("toggleNodeExpanded", nodeId, nodeData);
20+
let lastOpenedNodeNewState = true;
21+
let lastOpenedNodeID = getOpenIDFromNode(lastOpenedNodeRef.current);
22+
if(!lastOpenedNodeRef.current?.metadata?.has_children){
23+
lastOpenedNodeNewState = false;
24+
}
25+
lastOpenedNodeRef.current = {...nodeData};
1926
setTableData(nodeData);
2027
fetchFolderData(nodeData);
2128
setOpenNodes({
2229
...openNodes,
23-
[getOpenIDFromNode(nodeData)]: true
30+
[getOpenIDFromNode(nodeData)]: true,
31+
[lastOpenedNodeID]: lastOpenedNodeNewState
2432
});
2533
};
2634
const toggleNodeCollapsed = (nodeId, nodeData) => {

MythicReactUI/src/components/pages/Callbacks/ResponseDisplayMedia.js

+25-1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ const fileMetaQuery = gql`
6464
full_remote_path_text
6565
size
6666
agent_file_id
67+
complete
68+
total_chunks
69+
chunks_received
6770
task {
6871
display_id
6972
id
@@ -97,6 +100,9 @@ export const ResponseDisplayMedia = ({media, expand, task}) =>{
97100
size: data.filemeta[0].size,
98101
agent_file_id: data.filemeta[0].agent_file_id,
99102
task_display_id: data.filemeta[0]?.task?.display_id,
103+
complete: data.filemeta[0].complete,
104+
total_chunks: data.filemeta[0].total_chunks,
105+
chunks_received: data.filemeta[0].chunks_received
100106
})
101107
} else {
102108
snackActions.warning("failed to find file specified")
@@ -324,7 +330,25 @@ const DisplayFileMetaData = ({fileMetaData}) => {
324330
</TableHead>
325331
<TableBody>
326332
<TableRow>
327-
<MythicStyledTableCell><TableRowSizeCell cellData={fileMetaData.size}/></MythicStyledTableCell>
333+
<MythicStyledTableCell>
334+
<TableRowSizeCell cellData={fileMetaData.size}/>
335+
{fileMetaData.complete ? null : (
336+
<>
337+
<br/>
338+
<Typography style={{display: "inline-block", color: "red"}}>
339+
{fileMetaData.chunks_received}
340+
</Typography>
341+
/
342+
<Typography style={{display: "inline-block"}}>
343+
{fileMetaData.total_chunks}
344+
</Typography>
345+
<Typography style={{display: "inline-block", whiteSpace: "pre"}}>
346+
{" Chunks"}
347+
</Typography>
348+
</>
349+
350+
)}
351+
</MythicStyledTableCell>
328352
<MythicStyledTableCell style={{wordBreak: "break-all"}}>{fileMetaData.host}</MythicStyledTableCell>
329353
<MythicStyledTableCell style={{wordBreak: "break-all"}}>{fileMetaData.filename}</MythicStyledTableCell>
330354
<MythicStyledTableCell style={{wordBreak: "break-all"}}>{fileMetaData.full_remote_path}</MythicStyledTableCell>

MythicReactUI/src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {snackActions} from './components/utilities/Snackbar';
1414
import jwt_decode from 'jwt-decode';
1515
import {meState} from './cache';
1616

17-
export const mythicUIVersion = "0.2.37";
17+
export const mythicUIVersion = "0.2.38";
1818

1919
let fetchingNewToken = false;
2020

Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"files": {
33
"main.css": "/new/static/css/main.7e143bf2.css",
4-
"main.js": "/new/static/js/main.e8fbb638.js",
4+
"main.js": "/new/static/js/main.333ca8d7.js",
55
"static/media/mythic-red.png": "/new/static/media/mythic-red.203468a4e5240d239aa0.png",
66
"static/media/mythic_red_small.svg": "/new/static/media/mythic_red_small.793b41cc7135cdede246661ec232976b.svg",
77
"index.html": "/new/index.html",
88
"main.7e143bf2.css.map": "/new/static/css/main.7e143bf2.css.map",
9-
"main.e8fbb638.js.map": "/new/static/js/main.e8fbb638.js.map"
9+
"main.333ca8d7.js.map": "/new/static/js/main.333ca8d7.js.map"
1010
},
1111
"entrypoints": [
1212
"static/css/main.7e143bf2.css",
13-
"static/js/main.e8fbb638.js"
13+
"static/js/main.333ca8d7.js"
1414
]
1515
}
Original file line numberDiff line numberDiff line change
@@ -1 +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.e8fbb638.js"></script><link href="/new/static/css/main.7e143bf2.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
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.333ca8d7.js"></script><link href="/new/static/css/main.7e143bf2.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>

mythic-react-docker/mythic/public/static/js/main.e8fbb638.js renamed to mythic-react-docker/mythic/public/static/js/main.333ca8d7.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mythic-react-docker/mythic/public/static/js/main.e8fbb638.js.map renamed to mythic-react-docker/mythic/public/static/js/main.333ca8d7.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)