Skip to content

Commit

Permalink
file browser bug fix and ui tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
its-a-feature committed Aug 28, 2024
1 parent 9814142 commit 5fdf8f1
Show file tree
Hide file tree
Showing 17 changed files with 60 additions and 19 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ 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-rc1] - 2024-08-28

### Changed

- Fixed an issue where sometimes the 'success' flag for file browser objects would get reset

## [3.3.0-rc23] - 2024-08-27

### Changed
Expand Down
3 changes: 2 additions & 1 deletion MythicReactUI/CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ 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.36] - 2024-08-28
## [0.2.36-37] - 2024-08-28

### Changed

- Fixed a bug where new file listings on blank data could result in a white screen
- Fixed an opacity bug with tag dragging

## [0.2.35] - 2024-08-28

Expand Down
18 changes: 15 additions & 3 deletions MythicReactUI/src/components/MythicComponents/MythicTabPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@ function a11yProps(index) {
}
function allowDrop(ev) {
ev.preventDefault();
return true;
}

function drag(ev) {
ev.dataTransfer.setData("text", ev.target.id);
ev.dataTransfer.setData("opacity", ev.target.style.opacity);
ev.target.style.opacity = "0.2";
//ev.dataTransfer.setData("opacity", ev.target.style.opacity);
//ev.target.style.opacity = "0.2";
}

function onDragEnter(ev){
Expand All @@ -60,28 +61,38 @@ function allowDrop(ev) {

function onDragLeave(ev){
let node = ev.target.closest('[role="tab"]');
//console.log("onDragLeave");
if(ev.target.getAttribute("role") === "tab"){
//console.log("leaving tab", ev.target)
node.style.border = "";
} else if(node.contains(ev.target)){
//node.style.border = "";
//console.log("onDragLeave, nodeContains", node, ev.target)
}else{
node.style.border = "";
//console.log("onDragLeave, not contains", node, ev.target)
}
}

function onDragStop(ev) {
let node = ev.target.getAttribute("role") === "tab" ? ev.target : ev.target.closest('[role="tab"]');
node.style.border = "";
}

function drop(ev) {
// shares dataTransfer with drag function
//console.log("drop")
ev.preventDefault();
const data = ev.dataTransfer.getData("text");
const tabList = ev.target.closest("div[role='tablist']");
let node = ev.target.getAttribute("role") === "tab" ? ev.target : ev.target.closest('[role="tab"]');
//console.log(tabList, data, node.nextSibling);
node.style.border = "";
document.getElementById(data).style.opacity = ev.dataTransfer.getData("opacity");
//node.style.opacity = 1;
//document.getElementById(data).style.opacity = ev.dataTransfer.getData("opacity");
for(let i = 0; i < tabList.children.length; i++){
tabList.children[i].style.border = "";
//tabList.children[i].style.opacity = 1;
}
//tabList.insertBefore(document.getElementById(data), node.nextSibling);
//console.log("selected", data, "toLeftOf", node.id);
Expand Down Expand Up @@ -137,6 +148,7 @@ export function MythicTabLabel(props) {
draggable={!!onDragTab}
className={selectedIndex === index ? "selectedCallback" : "" }
onDragStart={drag}
onDragEnd={onDragStop}
label={
<span onContextMenu={handleContextClick} style={{ display: 'inline-block', zIndex: 1}} ref={dropdownAnchorRef}>
{label}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class MythicTextField extends React.Component {
error={this.checkError()}
type={this.props.type === undefined ? "text" : this.props.type}
onWheel={ event => event.target.blur() }
InputProps={this.props.InputProps}
InputProps={{...this?.props?.InputProps, spellCheck: false}}
helperText={this.checkError() ? this.props.errorText : this.props.helperText}
style={{
padding:0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,11 @@ export const CallbacksTabsFileBrowserPanel = ({ index, value, tabInfo, me }) =>
treeRootDataRef.current[currentGroups[j]][mythictree[i]["host"]][mythictree[i]["full_path_text"]].filemeta = treeRootDataRef.current[currentGroups[j]][mythictree[i]["host"]][mythictree[i]["full_path_text"]].filemeta.map(f => {
return {...f, filename_text: b64DecodeUnicode(f.filename_text)}
})
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]});
}
} else {
// we need to merge data in because we already have some info
let existingData = treeRootDataRef.current[currentGroups[j]][mythictree[i]["host"]][mythictree[i]["full_path_text"]];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import 'ace-builds/src-noconflict/mode-kotlin';
import 'ace-builds/src-noconflict/mode-dockerfile';
import 'ace-builds/src-noconflict/mode-sh';
import 'ace-builds/src-noconflict/mode-ini';
import 'ace-builds/src-noconflict/mode-apache_conf';
import {MythicStyledTooltip} from "../../MythicComponents/MythicStyledTooltip";
import AppBar from '@mui/material/AppBar';
import Tabs from '@mui/material/Tabs';
Expand Down Expand Up @@ -170,7 +171,7 @@ const textExtensionTypes = ["txt", "ps1", "php", "json", "yml", "yaml", "config"
"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"
"history", "historynew", "bashrc"
];
const textExtensionTypesToSyntax = {
"json": "json",
Expand All @@ -197,7 +198,10 @@ const textExtensionTypesToSyntax = {
"Makefile": "Makefile",
"sh": "sh",
"rc": "sh",
"bashrc": "sh",
"zshrc": "sh",
"ini": "ini",
"conf": "apache_conf"
}
const knownTextFiles = ["config", "credentials", "known_hosts", "config_default", "id_rsa", "Dockerfile", "Makefile"];
const imgExtensionTypes = ["png", "jpg", "gif", "jpeg", "pdf"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ import 'ace-builds/src-noconflict/mode-kotlin';
import 'ace-builds/src-noconflict/mode-dockerfile';
import 'ace-builds/src-noconflict/mode-sh';
import 'ace-builds/src-noconflict/mode-ini';
import 'ace-builds/src-noconflict/mode-apache_conf';
import {useTheme} from '@mui/material/styles';
import FormControl from '@mui/material/FormControl';

export const modeOptions = ["csharp", "golang", "html", "json", "markdown", "ruby", "python", "java",
"javascript", "yaml", "toml", "swift", "sql", "rust", "powershell", "pgsql", "perl", "php", "objectivec",
"nginx", "makefile", "kotlin", "dockerfile", "sh", "ini"].sort();
"nginx", "makefile", "kotlin", "dockerfile", "sh", "ini", "conf"].sort();
export function PreviewFileStringDialog(props) {
const theme = useTheme();
const [mode, setMode] = React.useState("json");
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.36";
export const mythicUIVersion = "0.2.37";

let fetchingNewToken = false;

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.0
3.3.1-rc1
2 changes: 1 addition & 1 deletion mythic-docker/src/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.0
3.3.1-rc1
Original file line number Diff line number Diff line change
Expand Up @@ -1925,6 +1925,12 @@ func updateTreeNode(treeNode databaseStructs.MythicTree) {
`, treeNode); err != nil {
logging.LogError(err, "Failed to update tree node")
}
if treeNode.Success.Valid {
_, err := database.DB.NamedExec(`UPDATE mythictree SET success=:success WHERE id=:id`, treeNode)
if err != nil {
logging.LogError(err, "failed to update success status on tree node")
}
}
}
func deleteTreeNode(treeNode databaseStructs.MythicTree, cascade bool) {
if cascade {
Expand Down Expand Up @@ -1957,7 +1963,7 @@ func createTreeNode(treeNode *databaseStructs.MythicTree) {
ON CONFLICT (host, operation_id, full_path, tree_type, callback_id)
DO UPDATE SET
task_id=:task_id, "name"=:name, parent_path=:parent_path, can_have_children=:can_have_children,
metadata=mythictree.metadata || :metadata, os=:os, "timestamp"=now(), deleted=false, success=:success
metadata=mythictree.metadata || :metadata, os=:os, "timestamp"=now(), deleted=false
RETURNING id`)
if err != nil {
logging.LogError(err, "Failed to create new mythictree statement")
Expand All @@ -1967,6 +1973,12 @@ func createTreeNode(treeNode *databaseStructs.MythicTree) {
if err != nil {
logging.LogError(err, "Failed to create new mythictree entry")
}
if treeNode.Success.Valid {
_, err = database.DB.NamedExec(`UPDATE mythictree SET success=:success WHERE id=:id`, treeNode)
if err != nil {
logging.LogError(err, "failed to update success status on tree node")
}
}
}
func addFileMetaToMythicTree(task databaseStructs.Task, newFile databaseStructs.Filemeta) {
fileBrowser := databaseStructs.MythicTree{}
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.0d85b5a2.js",
"main.js": "/new/static/js/main.e8fbb638.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.0d85b5a2.js.map": "/new/static/js/main.0d85b5a2.js.map"
"main.e8fbb638.js.map": "/new/static/js/main.e8fbb638.js.map"
},
"entrypoints": [
"static/css/main.7e143bf2.css",
"static/js/main.0d85b5a2.js"
"static/js/main.e8fbb638.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.0d85b5a2.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.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>
3 changes: 0 additions & 3 deletions mythic-react-docker/mythic/public/static/js/main.0d85b5a2.js

This file was deleted.

3 changes: 3 additions & 0 deletions mythic-react-docker/mythic/public/static/js/main.e8fbb638.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

0 comments on commit 5fdf8f1

Please sign in to comment.