Skip to content

Commit f589004

Browse files
committed
updating mythic-cli for better local-building
updating UI plaintext view to be more streamlined
1 parent c3d443e commit f589004

File tree

14 files changed

+118
-49
lines changed

14 files changed

+118
-49
lines changed

Makefile

+9-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@
22
default: linux ;
33

44
linux:
5-
cd Mythic_CLI && make && mv mythic-cli ../
5+
cd Mythic_CLI && make build_linux && mv mythic-cli ../
66

77
macos:
88
cd Mythic_CLI && make build_macos && mv mythic-cli ../
99

10-
macos_local:
11-
cd Mythic_CLI && make build_binary_macos_local
10+
local:
11+
cd Mythic_CLI && make build_local
12+
13+
linux_docker:
14+
cd Mythic_CLI && make build_linux_docker && mv mythic-cli ../
15+
16+
macos_docker:
17+
cd Mythic_CLI && make build_macos_docker && mv mythic-cli ../

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.1.63] - 2024-02-07
8+
9+
### Changed
10+
11+
- Adjusted the syntax highlighter and wrap options for plaintext output to be hidden by default with a small button
12+
- Updated download text links in snack actions to be normal text color instead of blue
13+
714
## [0.1.62] - 2024-02-06
815

916
### Changed

MythicReactUI/src/components/MythicComponents/MythicSnackDownload.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from 'react';
22
import { styled } from '@mui/material/styles';
3-
import {useTheme} from '@mui/material/styles';
43
import Typography from '@mui/material/Typography';
54
import { Link } from '@mui/material';
65

@@ -78,7 +77,7 @@ export const MythicSnackDownload = (props) => {
7877
</Typography>
7978
<React.Fragment>
8079
<Typography gutterBottom>File ready for download</Typography>
81-
<Link download={true} href={"/direct/download/" + props.file_id} target="_blank">
80+
<Link color="textPrimary" download={true} href={"/direct/download/" + props.file_id} target="_blank">
8281
Download here
8382
</Link>
8483
</React.Fragment>

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

+14-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Button, IconButton } from '@mui/material';
44
import {useMythicSetting} from "../../MythicComponents/MythicSavedUserSetting";
55
import {modeOptions} from "../Search/PreviewFileStringDialog";
66
import MenuItem from '@mui/material/MenuItem';
7-
import Select from '@mui/material/Select';
7+
import TextField from '@mui/material/TextField';
88
import AceEditor from 'react-ace';
99
import {useTheme} from '@mui/material/styles';
1010
import {snackActions} from "../../utilities/Snackbar";
@@ -27,6 +27,8 @@ import {MythicStyledTooltip} from "../../MythicComponents/MythicStyledTooltip";
2727
export const ResponseDisplayMedia = ({media, expand}) =>{
2828
return <DisplayMedia agent_file_id={media?.agent_file_id || ""} filename={media?.filename || undefined} expand={expand} />
2929
}
30+
const textExtensionTypes = ["txt", "ps1", "php", "json", "yml", "yaml", "config", "cfg", "go",
31+
"html", "xml", "js", "java", "conf", "cs", "rb", "toml"];
3032
const mimeType = (path) => {
3133
if(!path){return undefined}
3234
let extension = path.split(".");
@@ -35,7 +37,7 @@ const mimeType = (path) => {
3537
if(["png", "jpg", "gif", "jpeg", "pdf"].includes(extension)){
3638
return "object";
3739
}
38-
if(["txt", "ps1", "php", "json", "yml", "yaml", "config", "cfg", "go", "html", "xml", "js", "java"].includes(extension)){
40+
if(textExtensionTypes.includes(extension)){
3941
return "text";
4042
}
4143
return undefined;
@@ -157,19 +159,24 @@ const DisplayText = ({agent_file_id, expand}) => {
157159
}
158160
return (
159161
<div style={{display: "flex", height: "100%", flexDirection: "column"}}>
160-
<div>
161-
<FormControl sx={{ width: "20%", display: "inline-block" }} size="small">
162-
<Select
163-
style={{display: "inline-block", width: "100%"}}
162+
<div style={{display: "inline-flex", flexDirection: "row"}}>
163+
<FormControl sx={{ display: "inline-block" }} size="small" color={"secondary"}>
164+
<TextField
165+
select
166+
label={"Syntax"}
167+
margin={"dense"}
168+
size={"small"}
169+
style={{display: "inline-block", width: "100%",}}
164170
value={mode}
171+
sx={{padding: 0}}
165172
onChange={onChangeMode}
166173
>
167174
{
168175
modeOptions.map((opt, i) => (
169176
<MenuItem key={"searchopt" + opt} value={opt}>{opt}</MenuItem>
170177
))
171178
}
172-
</Select>
179+
</TextField>
173180
</FormControl>
174181
<MythicStyledTooltip title={wrapText ? "Unwrap Text" : "Wrap Text"} >
175182
<IconButton onClick={toggleWrapText} style={{}}>

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

+43-22
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,18 @@ import 'ace-builds/src-noconflict/mode-java';
1919
import 'ace-builds/src-noconflict/mode-javascript';
2020
import {MythicStyledTooltip} from "../../MythicComponents/MythicStyledTooltip";
2121
import MenuItem from '@mui/material/MenuItem';
22-
import Select from '@mui/material/Select';
22+
import TextField from '@mui/material/TextField';
2323
import { IconButton } from '@mui/material';
24+
import UnfoldMoreIcon from '@mui/icons-material/UnfoldMore';
25+
import UnfoldLessIcon from '@mui/icons-material/UnfoldLess';
2426

2527
const MaxRenderSize = 2000000;
2628
export const ResponseDisplayPlaintext = (props) =>{
2729
const theme = useTheme();
2830
const [plaintextView, setPlaintextView] = React.useState("");
2931
const [mode, setMode] = React.useState("html");
3032
const [wrapText, setWrapText] = React.useState(true);
33+
const [showOptions, setShowOptions] = React.useState(false);
3134
useEffect( () => {
3235
if(props.plaintext.length > MaxRenderSize){
3336
snackActions.warning("Response too large (> 2MB), truncating the render. Download task output to view entire response.");
@@ -48,30 +51,48 @@ export const ResponseDisplayPlaintext = (props) =>{
4851
const toggleWrapText = () => {
4952
setWrapText(!wrapText);
5053
}
54+
const onChangeShowOptions = (e) => {
55+
setShowOptions(!showOptions);
56+
}
5157
return (
5258
<div style={{display: "flex", height: "100%", flexDirection: "column"}}>
53-
<div>
54-
<FormControl sx={{ width: "20%", display: "inline-block" }} size="small">
55-
<Select
56-
style={{display: "inline-block", width: "100%"}}
57-
value={mode}
58-
onChange={onChangeMode}
59-
>
60-
{
61-
modeOptions.map((opt, i) => (
62-
<MenuItem key={"searchopt" + opt} value={opt}>{opt}</MenuItem>
63-
))
64-
}
65-
</Select>
66-
</FormControl>
67-
<MythicStyledTooltip title={wrapText ? "Unwrap Text" : "Wrap Text"} >
68-
<IconButton onClick={toggleWrapText} style={{}}>
69-
<WrapTextIcon color={wrapText ? "success" : "secondary"}
70-
style={{cursor: "pointer"}}
71-
/>
72-
</IconButton>
73-
</MythicStyledTooltip>
59+
{showOptions &&
60+
<div style={{display: "inline-flex", flexDirection: "row"}}>
61+
<FormControl sx={{ display: "inline-block" }} size="small">
62+
<TextField
63+
label={"Syntax"}
64+
select
65+
margin={"dense"}
66+
size={"small"}
67+
style={{display: "inline-block", width: "100%"}}
68+
value={mode}
69+
onChange={onChangeMode}
70+
>
71+
{
72+
modeOptions.map((opt, i) => (
73+
<MenuItem key={"searchopt" + opt} value={opt}>{opt}</MenuItem>
74+
))
75+
}
76+
</TextField>
77+
</FormControl>
78+
<MythicStyledTooltip title={wrapText ? "Unwrap Text" : "Wrap Text"} >
79+
<IconButton onClick={toggleWrapText} style={{}}>
80+
<WrapTextIcon color={wrapText ? "success" : "secondary"}
81+
style={{cursor: "pointer"}}
82+
/>
83+
</IconButton>
84+
</MythicStyledTooltip>
85+
</div>
86+
}
87+
<div style={{height: "1px", width: "100%", display: "flex", zIndex: 1, justifyContent: "space-around", backgroundColor: theme.palette.secondary.main}}>
88+
{showOptions &&
89+
<UnfoldLessIcon onClick={onChangeShowOptions} style={{cursor: "pointer", position: "relative", top: "-8px"}} />
90+
}
91+
{!showOptions &&
92+
<UnfoldMoreIcon onClick={onChangeShowOptions} style={{cursor: "pointer", position: "relative", top: "-7px"}} />
93+
}
7494
</div>
95+
7596
<div style={{display: "flex", flexGrow: 1, height: "100%"}}>
7697
<AceEditor
7798
mode={mode}

MythicReactUI/src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import jwt_decode from 'jwt-decode';
1515
import {meState} from './cache';
1616

1717
export const mythicVersion = "3.2.17";
18-
export const mythicUIVersion = "0.1.62";
18+
export const mythicUIVersion = "0.1.63";
1919

2020
let fetchingNewToken = false;
2121

Mythic_CLI/Dockerfile

+20-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,20 @@
1-
FROM ghcr.io/its-a-feature/mythic_cli:v0.0.3.10
1+
#FROM itsafeaturemythic/mythic_go_base:latest
2+
FROM golang:1.21-alpine
3+
WORKDIR /usr/src/app
4+
5+
ARG GOPROXY=proxy.golang.org
6+
ARG GO111MODULE
7+
8+
RUN go env -w GOPROXY=${GOPROXY}
9+
RUN go env -w GO111MODULE=${GO111MODULE}
10+
11+
COPY ["src/", "."]
12+
13+
RUN apk add --no-cache make
14+
15+
RUN make build_all
16+
17+
FROM alpine
18+
19+
COPY --from=0 /usr/src/app/mythic-cli_linux /mythic-cli_linux
20+
COPY --from=0 /usr/src/app/mythic-cli_macos /mythic-cli_macos

Mythic_CLI/Makefile

+15-5
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,26 @@ default: build_linux ;
1010

1111
export
1212

13-
build_binary_linux:
13+
copy_binary_linux:
1414
docker run -v ${LOCAL_PATH}/copy_file/:/copy_file/ --rm ${BUILDER_IMAGE} sh -c "cp /mythic-cli_linux /copy_file/mythic-cli"
1515
mv ./copy_file/${BINARY_NAME} . && rm -rf ./copy_file && chmod +x ${BINARY_NAME}
1616

17-
build_binary_macos:
17+
copy_binary_macos:
1818
docker run -v ${LOCAL_PATH}/copy_file/:/copy_file/ --rm ${BUILDER_IMAGE} sh -c "cp /mythic-cli_macos /copy_file/mythic-cli"
1919
mv ./copy_file/${BINARY_NAME} . && rm -rf ./copy_file && chmod +x ${BINARY_NAME}
2020

21-
build_binary_macos_local:
21+
build_local:
2222
cd src && go build -o ../../mythic-cli .
2323

24-
build_linux: build_binary_linux
25-
build_macos: build_binary_macos
24+
build_linux_docker:
25+
docker build -t mythic-cli-builder -f Dockerfile .
26+
docker run -v ${LOCAL_PATH}/copy_file/:/copy_file/ --rm mythic-cli-builder sh -c "cp /mythic-cli_linux /copy_file/mythic-cli"
27+
mv ./copy_file/${BINARY_NAME} . && rm -rf ./copy_file && chmod +x ${BINARY_NAME}
28+
29+
build_macos_docker:
30+
docker build -t mythic-cli-builder -f Dockerfile .
31+
docker run -v ${LOCAL_PATH}/copy_file/:/copy_file/ --rm mythic-cli-builder sh -c "cp /mythic-cli_macos /copy_file/mythic-cli"
32+
mv ./copy_file/${BINARY_NAME} . && rm -rf ./copy_file && chmod +x ${BINARY_NAME}
33+
34+
build_linux: copy_binary_linux
35+
build_macos: copy_binary_macos
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"files": {
33
"main.css": "/new/static/css/main.00d51b79.css",
4-
"main.js": "/new/static/js/main.bdecbcc2.js",
4+
"main.js": "/new/static/js/main.8da14125.js",
55
"static/media/[email protected]": "/new/static/media/[email protected]",
66
"static/media/mythic_red_small.svg": "/new/static/media/mythic_red_small.793b41cc7135cdede246661ec232976b.svg",
77
"index.html": "/new/index.html",
88
"main.00d51b79.css.map": "/new/static/css/main.00d51b79.css.map",
9-
"main.bdecbcc2.js.map": "/new/static/js/main.bdecbcc2.js.map"
9+
"main.8da14125.js.map": "/new/static/js/main.8da14125.js.map"
1010
},
1111
"entrypoints": [
1212
"static/css/main.00d51b79.css",
13-
"static/js/main.bdecbcc2.js"
13+
"static/js/main.8da14125.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.bdecbcc2.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>
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.8da14125.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>

mythic-react-docker/mythic/public/static/js/main.8da14125.js

+3
Large diffs are not rendered by default.

mythic-react-docker/mythic/public/static/js/main.bdecbcc2.js.map mythic-react-docker/mythic/public/static/js/main.8da14125.js.map

+1-1
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.bdecbcc2.js

-3
This file was deleted.

0 commit comments

Comments
 (0)