Skip to content

Commit

Permalink
file browser and media display tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
its-a-feature committed Aug 29, 2024
1 parent 5c17b50 commit fef7336
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 20 deletions.
7 changes: 7 additions & 0 deletions MythicReactUI/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).

## [0.2.38] - 2024-08-29

### Changed

- Adjusted the file browser a bit to auto close folders with no data in them
- Adjusted the media render view to indicate if chunks are missing

## [0.2.36-37] - 2024-08-28

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,13 @@ export const CallbacksTabsFileBrowserPanel = ({ index, value, tabInfo, me }) =>
// new host discovered
treeRootDataRef.current[currentGroups[j]][data.mythictree[i]["host"]] = {};
}
treeRootDataRef.current[currentGroups[j]][data.mythictree[i]["host"]][data.mythictree[i]["full_path_text"]] = {...data.mythictree[i]}
if(treeRootDataRef.current[currentGroups[j]][data.mythictree[i]["host"]][data.mythictree[i]["full_path_text"]] === undefined){
treeRootDataRef.current[currentGroups[j]][data.mythictree[i]["host"]][data.mythictree[i]["full_path_text"]] = {...data.mythictree[i]};
} else {
if(treeRootDataRef.current[currentGroups[j]][data.mythictree[i]["host"]][data.mythictree[i]["full_path_text"]].success === null){
treeRootDataRef.current[currentGroups[j]][data.mythictree[i]["host"]][data.mythictree[i]["full_path_text"]] = {...data.mythictree[i]}
}
}
}
}
// create the top level data in the adjacency matrix
Expand Down Expand Up @@ -300,7 +306,7 @@ export const CallbacksTabsFileBrowserPanel = ({ index, value, tabInfo, me }) =>
if(selectedFolderData.group === currentGroups[j] && selectedFolderData.host === data.data.mythictree_stream[i]["host"] &&
selectedFolderData.full_path_text === data.data.mythictree_stream[i]["full_path_text"]){
setSelectedFolderData({...treeRootDataRef.current[currentGroups[j]][data.data.mythictree_stream[i]["host"]][data.data.mythictree_stream[i]["full_path_text"]],
group: currentGroups[j]});
group: currentGroups[j], fromHistory: selectedFolderData.fromHistory});
}
} else {
// we need to merge data in because we already have some info
Expand All @@ -319,10 +325,11 @@ export const CallbacksTabsFileBrowserPanel = ({ index, value, tabInfo, me }) =>
return {...f, filename_text: b64DecodeUnicode(f.filename_text)};
})
existingData.filemeta = [...existingData.filemeta, ...newfileData]

treeRootDataRef.current[currentGroups[j]][data.data.mythictree_stream[i]["host"]][data.data.mythictree_stream[i]["full_path_text"]] = {...existingData};
if(selectedFolderData.group === currentGroups[j] && selectedFolderData.host === data.data.mythictree_stream[i]["host"] &&
selectedFolderData.full_path_text === data.data.mythictree_stream[i]["full_path_text"]){
setSelectedFolderData({...existingData, group: currentGroups[j]});
setSelectedFolderData({...existingData, group: currentGroups[j], fromHistory: selectedFolderData.fromHistory});
}
}
}
Expand Down Expand Up @@ -391,7 +398,7 @@ export const CallbacksTabsFileBrowserPanel = ({ index, value, tabInfo, me }) =>
if(selectedFolderData.group === currentGroups[j] && selectedFolderData.host === mythictree[i]["host"] &&
selectedFolderData.full_path_text === mythictree[i]["full_path_text"]){
setSelectedFolderData({...treeRootDataRef.current[currentGroups[j]][mythictree[i]["host"]][mythictree[i]["full_path_text"]],
group: currentGroups[j]});
group: currentGroups[j], fromHistory: selectedFolderData.fromHistory});
}
} else {
// we need to merge data in because we already have some info
Expand All @@ -413,7 +420,9 @@ export const CallbacksTabsFileBrowserPanel = ({ index, value, tabInfo, me }) =>
treeRootDataRef.current[currentGroups[j]][mythictree[i]["host"]][mythictree[i]["full_path_text"]] = {...existingData};
if(selectedFolderData.group === currentGroups[j] && selectedFolderData.host === mythictree[i]["host"] &&
selectedFolderData.full_path_text === mythictree[i]["full_path_text"]){
setSelectedFolderData({...existingData, group: currentGroups[j]});
setSelectedFolderData({...existingData,
group: currentGroups[j],
fromHistory: selectedFolderData.fromHistory});
}
}
}
Expand Down Expand Up @@ -483,7 +492,7 @@ export const CallbacksTabsFileBrowserPanel = ({ index, value, tabInfo, me }) =>
host: parentData.host,
full_path_text: parentData.full_path_text
};
setSelectedFolderData(parentData);
setSelectedFolderData({...parentData, fromHistory: false});
};
const localSelectedToken = React.useRef("");
const onChangeSelectedToken = (token) => {
Expand Down Expand Up @@ -736,7 +745,7 @@ const FileBrowserTableTop = ({
return;
}
if(selectedFolderData.id !== ""){
if(history[0]?.id !== selectedFolderData.id){
if(history[0]?.full_path_text !== selectedFolderData.full_path_text){
// always add newest things to the bottom of the stack
setHistory([selectedFolderData, ...history]);
if(history.length > 20){
Expand All @@ -756,6 +765,7 @@ const FileBrowserTableTop = ({
}
const moveIndexToNextListing = () => {
// we're getting close to index 0, the newest listing
console.log(historyIndex, history);
if(historyIndex <= 0){
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -940,8 +940,10 @@ const FileBrowserTableRowActionCell = ({ rowData, cellData, onTaskRowAction, tre
<SettingsIcon />
</IconButton>
{treeRootData[selectedFolderData.host][cellData]?.filemeta.length > 0 ?
<MythicStyledTooltip title={"Preview Media"}>
<FontAwesomeIcon icon={faPhotoVideo} style={{height: "15px", marginRight: "5px", position: "relative", cursor: "pointer", display: "inline-block"}}
<MythicStyledTooltip title={treeRootData[selectedFolderData.host][cellData]?.filemeta[0]?.complete ?
"Preview Media" : "Preview Partial Media"}>
<FontAwesomeIcon icon={faPhotoVideo} style={{height: "15px", marginRight: "5px",
position: "relative", cursor: "pointer", display: "inline-block"}}
onClick={openFilePreview}/>
</MythicStyledTooltip>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,21 @@ export const CallbacksTabsFileBrowserTreePreMemo = ({ treeRootData, treeAdjMatri
const [openNodes, setOpenNodes] = React.useState({});
const groupName = React.useRef("");
const [openViewGroupsDialog, setOpenViewGroupDialog] = React.useState(false);
const lastOpenedNodeRef = React.useRef({group: "", host: "", full_path_text: ""});
const toggleNodeExpanded = (nodeId, nodeData) => {
//console.log("toggleNodeExpanded", nodeId, nodeData);
let lastOpenedNodeNewState = true;
let lastOpenedNodeID = getOpenIDFromNode(lastOpenedNodeRef.current);
if(!lastOpenedNodeRef.current?.metadata?.has_children){
lastOpenedNodeNewState = false;
}
lastOpenedNodeRef.current = {...nodeData};
setTableData(nodeData);
fetchFolderData(nodeData);
setOpenNodes({
...openNodes,
[getOpenIDFromNode(nodeData)]: true
[getOpenIDFromNode(nodeData)]: true,
[lastOpenedNodeID]: lastOpenedNodeNewState
});
};
const toggleNodeCollapsed = (nodeId, nodeData) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ const fileMetaQuery = gql`
full_remote_path_text
size
agent_file_id
complete
total_chunks
chunks_received
task {
display_id
id
Expand Down Expand Up @@ -97,6 +100,9 @@ export const ResponseDisplayMedia = ({media, expand, task}) =>{
size: data.filemeta[0].size,
agent_file_id: data.filemeta[0].agent_file_id,
task_display_id: data.filemeta[0]?.task?.display_id,
complete: data.filemeta[0].complete,
total_chunks: data.filemeta[0].total_chunks,
chunks_received: data.filemeta[0].chunks_received
})
} else {
snackActions.warning("failed to find file specified")
Expand Down Expand Up @@ -324,7 +330,25 @@ const DisplayFileMetaData = ({fileMetaData}) => {
</TableHead>
<TableBody>
<TableRow>
<MythicStyledTableCell><TableRowSizeCell cellData={fileMetaData.size}/></MythicStyledTableCell>
<MythicStyledTableCell>
<TableRowSizeCell cellData={fileMetaData.size}/>
{fileMetaData.complete ? null : (
<>
<br/>
<Typography style={{display: "inline-block", color: "red"}}>
{fileMetaData.chunks_received}
</Typography>
/
<Typography style={{display: "inline-block"}}>
{fileMetaData.total_chunks}
</Typography>
<Typography style={{display: "inline-block", whiteSpace: "pre"}}>
{" Chunks"}
</Typography>
</>

)}
</MythicStyledTableCell>
<MythicStyledTableCell style={{wordBreak: "break-all"}}>{fileMetaData.host}</MythicStyledTableCell>
<MythicStyledTableCell style={{wordBreak: "break-all"}}>{fileMetaData.filename}</MythicStyledTableCell>
<MythicStyledTableCell style={{wordBreak: "break-all"}}>{fileMetaData.full_remote_path}</MythicStyledTableCell>
Expand Down
2 changes: 1 addition & 1 deletion MythicReactUI/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {snackActions} from './components/utilities/Snackbar';
import jwt_decode from 'jwt-decode';
import {meState} from './cache';

export const mythicUIVersion = "0.2.37";
export const mythicUIVersion = "0.2.38";

let fetchingNewToken = false;

Expand Down
6 changes: 3 additions & 3 deletions mythic-react-docker/mythic/public/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"files": {
"main.css": "/new/static/css/main.7e143bf2.css",
"main.js": "/new/static/js/main.e8fbb638.js",
"main.js": "/new/static/js/main.333ca8d7.js",
"static/media/mythic-red.png": "/new/static/media/mythic-red.203468a4e5240d239aa0.png",
"static/media/mythic_red_small.svg": "/new/static/media/mythic_red_small.793b41cc7135cdede246661ec232976b.svg",
"index.html": "/new/index.html",
"main.7e143bf2.css.map": "/new/static/css/main.7e143bf2.css.map",
"main.e8fbb638.js.map": "/new/static/js/main.e8fbb638.js.map"
"main.333ca8d7.js.map": "/new/static/js/main.333ca8d7.js.map"
},
"entrypoints": [
"static/css/main.7e143bf2.css",
"static/js/main.e8fbb638.js"
"static/js/main.333ca8d7.js"
]
}
2 changes: 1 addition & 1 deletion mythic-react-docker/mythic/public/index.html
Original file line number Diff line number Diff line change
@@ -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>
<!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>

Large diffs are not rendered by default.

Large diffs are not rendered by default.

0 comments on commit fef7336

Please sign in to comment.