Skip to content

Commit

Permalink
UI and mythic-cli fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
its-a-feature committed Jan 29, 2024
1 parent e90a555 commit e73ab8e
Show file tree
Hide file tree
Showing 18 changed files with 59 additions and 37 deletions.
6 changes: 6 additions & 0 deletions MythicReactUI/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).

## 0.1.60] - 2024-01-29

### Changed

- Fixed a bug with the default value checks for saved user settings in the localStorage

## [0.1.59] - 2024-01-28

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ setting_name options:
export function useMythicSetting({setting_name, default_value, output="boolean"}){
const me = useReactiveVar(meState);
// get the initial value we have stored

const localStorageSetting = localStorage.getItem(`${me?.user?.user_id || 0}-${setting_name}`);
let initialStorageSetting = localStorageSetting === null ? default_value : localStorageSetting;

switch(output){
case "boolean":
initialStorageSetting = (localStorageSetting.toLowerCase() === "true");
initialStorageSetting = (initialStorageSetting.toLowerCase() === "true");
break;
case "number":
initialStorageSetting = Number(localStorageSetting);
initialStorageSetting = Number(initialStorageSetting);
break;
default:
console.log("unknown output type", output);
Expand All @@ -35,10 +35,10 @@ export function useMythicSetting({setting_name, default_value, output="boolean"}

switch(output){
case "boolean":
initialStorageSetting = (localStorageSetting.toLowerCase() === "true");
initialStorageSetting = (initialStorageSetting.toLowerCase() === "true");
break;
case "number":
initialStorageSetting = Number(localStorageSetting);
initialStorageSetting = Number(initialStorageSetting);
break;
default:
console.log("unknown output type", output);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ const ResponseDisplayComponent = ({rawResponses, viewBrowserScript, output, comm
const [localViewBrowserScript, setViewBrowserScript] = React.useState(true);
const [browserScriptData, setBrowserScriptData] = React.useState({});
const [loadingBrowserScript, setLoadingBrowserScript] = React.useState(true);
const useNewBrowserScriptTable = useMythicSetting({setting_name: "experiment-browserscripttable", default_value: false});
const useNewBrowserScriptTable = useMythicSetting({setting_name: "experiment-browserscripttable", default_value: "false"});
const script = React.useRef();
const me = useReactiveVar(meState);
useEffect( () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const mimeType = (path) => {
return undefined;
}
export const DisplayMedia = ({agent_file_id, filename, expand}) => {
const showMediaSetting = useMythicSetting({setting_name: "showMedia", default_value: true});
const showMediaSetting = useMythicSetting({setting_name: "showMedia", default_value: "true"});
const [showMedia, setShowMedia] = React.useState(showMediaSetting);
const [fileData, setFileData] = React.useState({
display: false,
Expand Down
8 changes: 4 additions & 4 deletions MythicReactUI/src/components/pages/Callbacks/TaskDisplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,11 @@ const ColoredTaskDisplay = ({task, theme, children}) => {
const ColoredTaskLabel = ({task, theme, me, taskDivID, onClick }) => {
const [displayComment, setDisplayComment] = React.useState(false);
const [alertBadges, setAlertBadges] = React.useState(0);
const initialHideUsernameValue = useMythicSetting({setting_name: "hideUsernames", default_value: false});
const initialShowIPValue = useMythicSetting({setting_name: "showIP", default_value: false});
const initialHideUsernameValue = useMythicSetting({setting_name: "hideUsernames", default_value: "false"});
const initialShowIPValue = useMythicSetting({setting_name: "showIP", default_value: "false"});
const ipValue = JSON.parse(task.callback.ip)[0];
const initialShowHostnameValue = useMythicSetting({setting_name: "showHostname", default_value: false});
const initialShowCallbackGroupsValue = useMythicSetting({setting_name: "showCallbackGroups", default_value: false});
const initialShowHostnameValue = useMythicSetting({setting_name: "showHostname", default_value: "false"});
const initialShowCallbackGroupsValue = useMythicSetting({setting_name: "showCallbackGroups", default_value: "false"});
const toggleDisplayComment = (evt) => {
evt.stopPropagation();
setDisplayComment(!displayComment);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {snackActions} from "../../utilities/Snackbar";

export function SettingsOperatorExperimentalUIConfigDialog(props) {
const me = props.me;
const initialNewBrowserScriptTable = useMythicSetting({setting_name: "experiment-browserscripttable", default_value: false});
const initialNewBrowserScriptTable = useMythicSetting({setting_name: "experiment-browserscripttable", default_value: "false"});
const [newBrowserScriptTables, setNewBrowserScriptTables] = React.useState(initialNewBrowserScriptTable);
const initialResponseStreamLimit = useMythicSetting({setting_name: "experiment-responseStreamLimit", default_value: 10, output: "number"})
const [newResponseStreamLimit, setNewResponseStreamLimit] = React.useState(initialResponseStreamLimit);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ export function SettingsOperatorUIConfigDialog(props) {
const [fontFamily, setFontFamily] = React.useState(initialLocalStorageFontFamilyValue);
const [topColor, setTopColor] = React.useState(initialLocalStorageTopColorValue);

const initialShowMediaValue = useMythicSetting({setting_name: "showMedia", default_value: true});
const initialShowMediaValue = useMythicSetting({setting_name: "showMedia", default_value: "true"});
const [showMedia, setShowMedia] = React.useState(initialShowMediaValue);

const initialHideUsernameValue = useMythicSetting({setting_name: "hideUsernames", default_value: false});
const initialHideUsernameValue = useMythicSetting({setting_name: "hideUsernames", default_value: "false"});
const [hideUsernames, setHideUsernames] = React.useState(initialHideUsernameValue);

const initialShowIPValue = useMythicSetting({setting_name: "showIP", default_value: false});
const initialShowIPValue = useMythicSetting({setting_name: "showIP", default_value: "false"});
const [showIP, setShowIP] = React.useState(initialShowIPValue);

const initialShowHostnameValue = useMythicSetting({setting_name: "showHostname", default_value: false});
const initialShowHostnameValue = useMythicSetting({setting_name: "showHostname", default_value: "false"});
const [showHostname, setShowHostname] = React.useState(initialShowHostnameValue);

const initialShowCallbackGroupsValue = useMythicSetting({setting_name: "showCallbackGroups", default_value: false});
const initialShowCallbackGroupsValue = useMythicSetting({setting_name: "showCallbackGroups", default_value: "false"});
const [showCallbackGroups, setShowCallbackGroups] = React.useState(initialShowCallbackGroupsValue);

const [resumeNotifications, setResumeNotifications] = React.useState(false);
Expand Down
2 changes: 1 addition & 1 deletion MythicReactUI/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import jwt_decode from 'jwt-decode';
import {meState} from './cache';

export const mythicVersion = "3.2.16";
export const mythicUIVersion = "0.1.59";
export const mythicUIVersion = "0.1.60";

let fetchingNewToken = false;

Expand Down
6 changes: 6 additions & 0 deletions Mythic_CLI/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](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## 0.2.6 - 2024-01-29

### Changed

- Fixed an issue with parsing empty docker-compose files not adding in necessary services key

## 0.2.5 - 2024-01-28

### Changed
Expand Down
2 changes: 1 addition & 1 deletion Mythic_CLI/src/cmd/config/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ package config

var (
// Version Mythic CLI version
Version = "v0.2.5"
Version = "v0.2.6"
)
2 changes: 1 addition & 1 deletion Mythic_CLI/src/cmd/internal/serviceExecution.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func ServiceStart(containers []string) error {
finalContainers = append(finalContainers, val)
}
}
// make sure we always update the config when starting in case .env variables changed
// make sure we always update the config when starting in case .env variables changed\
for _, service := range finalContainers {
if utils.StringInSlice(service, config.MythicPossibleServices) {
AddMythicService(service)
Expand Down
2 changes: 1 addition & 1 deletion Mythic_CLI/src/cmd/internal/serviceMetadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func AddMythicService(service string) {
log.Fatalf("[-] Failed to get current configuration information: %v\n", err)
}
if _, ok := pStruct["environment"]; !ok {
pStruct["environment"] = []string{}
pStruct["environment"] = []interface{}{}
}
mythicEnv := config.GetMythicEnv()
volumes, _ := manager.GetManager().GetVolumes()
Expand Down
26 changes: 18 additions & 8 deletions Mythic_CLI/src/cmd/manager/dockerComposeManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ func (d *DockerComposeManager) GetServiceConfiguration(service string) (map[stri
func (d *DockerComposeManager) SetServiceConfiguration(service string, pStruct map[string]interface{}) error {
curConfig := d.readInDockerCompose()
allConfigValues := curConfig.AllSettings()
if _, ok := allConfigValues["services"]; !ok {
allConfigValues["services"] = map[string]interface{}{}
}
for key, _ := range allConfigValues {
if key == "services" {
allServices := allConfigValues["services"].(map[string]interface{})
Expand Down Expand Up @@ -1207,13 +1210,16 @@ func (d *DockerComposeManager) GetAllInstalled3rdPartyServiceNames() ([]string,
}
}
servicesSub := groupNameConfig.Sub("services")
services := servicesSub.AllSettings()
containerList := []string{}
for service := range services {
if !utils.StringInSlice(service, config.MythicPossibleServices) {
containerList = append(containerList, service)
if servicesSub != nil {
services := servicesSub.AllSettings()
for service := range services {
if !utils.StringInSlice(service, config.MythicPossibleServices) {
containerList = append(containerList, service)
}
}
}

return containerList, nil
}

Expand All @@ -1233,12 +1239,16 @@ func (d *DockerComposeManager) GetCurrentMythicServiceNames() ([]string, error)
}
}
servicesSub := groupNameConfig.Sub("services")
services := servicesSub.AllSettings()

containerList := []string{}
for service := range services {
if utils.StringInSlice(service, config.MythicPossibleServices) {
containerList = append(containerList, service)
if servicesSub != nil {
services := servicesSub.AllSettings()
for service := range services {
if utils.StringInSlice(service, config.MythicPossibleServices) {
containerList = append(containerList, service)
}
}
}

return containerList, nil
}
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.00d51b79.css",
"main.js": "/new/static/js/main.de226fe0.js",
"main.js": "/new/static/js/main.3c53c679.js",
"static/media/mythic@2x.png": "/new/static/media/mythic@2x.7c5b62b471ac779fd706.png",
"static/media/mythic_red_small.svg": "/new/static/media/mythic_red_small.793b41cc7135cdede246661ec232976b.svg",
"index.html": "/new/index.html",
"main.00d51b79.css.map": "/new/static/css/main.00d51b79.css.map",
"main.de226fe0.js.map": "/new/static/js/main.de226fe0.js.map"
"main.3c53c679.js.map": "/new/static/js/main.3c53c679.js.map"
},
"entrypoints": [
"static/css/main.00d51b79.css",
"static/js/main.de226fe0.js"
"static/js/main.3c53c679.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.de226fe0.js"></script><link href="/new/static/css/main.00d51b79.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.3c53c679.js"></script><link href="/new/static/css/main.00d51b79.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 e73ab8e

Please sign in to comment.