updating mythic-cli for better local-building

updating UI plaintext view to be more streamlined
This commit is contained in:
its-a-feature
2024-02-07 13:53:14 -06:00
parent c3d443ea91
commit f5890049fa
14 changed files with 118 additions and 49 deletions
+9 -3
View File
@@ -2,10 +2,16 @@
default: linux ;
linux:
cd Mythic_CLI && make && mv mythic-cli ../
cd Mythic_CLI && make build_linux && mv mythic-cli ../
macos:
cd Mythic_CLI && make build_macos && mv mythic-cli ../
macos_local:
cd Mythic_CLI && make build_binary_macos_local
local:
cd Mythic_CLI && make build_local
linux_docker:
cd Mythic_CLI && make build_linux_docker && mv mythic-cli ../
macos_docker:
cd Mythic_CLI && make build_macos_docker && mv mythic-cli ../
+7
View File
@@ -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.1.63] - 2024-02-07
### Changed
- Adjusted the syntax highlighter and wrap options for plaintext output to be hidden by default with a small button
- Updated download text links in snack actions to be normal text color instead of blue
## [0.1.62] - 2024-02-06
### Changed
@@ -1,6 +1,5 @@
import React from 'react';
import { styled } from '@mui/material/styles';
import {useTheme} from '@mui/material/styles';
import Typography from '@mui/material/Typography';
import { Link } from '@mui/material';
@@ -78,7 +77,7 @@ export const MythicSnackDownload = (props) => {
</Typography>
<React.Fragment>
<Typography gutterBottom>File ready for download</Typography>
<Link download={true} href={"/direct/download/" + props.file_id} target="_blank">
<Link color="textPrimary" download={true} href={"/direct/download/" + props.file_id} target="_blank">
Download here
</Link>
</React.Fragment>
@@ -4,7 +4,7 @@ import { Button, IconButton } from '@mui/material';
import {useMythicSetting} from "../../MythicComponents/MythicSavedUserSetting";
import {modeOptions} from "../Search/PreviewFileStringDialog";
import MenuItem from '@mui/material/MenuItem';
import Select from '@mui/material/Select';
import TextField from '@mui/material/TextField';
import AceEditor from 'react-ace';
import {useTheme} from '@mui/material/styles';
import {snackActions} from "../../utilities/Snackbar";
@@ -27,6 +27,8 @@ import {MythicStyledTooltip} from "../../MythicComponents/MythicStyledTooltip";
export const ResponseDisplayMedia = ({media, expand}) =>{
return <DisplayMedia agent_file_id={media?.agent_file_id || ""} filename={media?.filename || undefined} expand={expand} />
}
const textExtensionTypes = ["txt", "ps1", "php", "json", "yml", "yaml", "config", "cfg", "go",
"html", "xml", "js", "java", "conf", "cs", "rb", "toml"];
const mimeType = (path) => {
if(!path){return undefined}
let extension = path.split(".");
@@ -35,7 +37,7 @@ const mimeType = (path) => {
if(["png", "jpg", "gif", "jpeg", "pdf"].includes(extension)){
return "object";
}
if(["txt", "ps1", "php", "json", "yml", "yaml", "config", "cfg", "go", "html", "xml", "js", "java"].includes(extension)){
if(textExtensionTypes.includes(extension)){
return "text";
}
return undefined;
@@ -157,11 +159,16 @@ const DisplayText = ({agent_file_id, expand}) => {
}
return (
<div style={{display: "flex", height: "100%", flexDirection: "column"}}>
<div>
<FormControl sx={{ width: "20%", display: "inline-block" }} size="small">
<Select
style={{display: "inline-block", width: "100%"}}
<div style={{display: "inline-flex", flexDirection: "row"}}>
<FormControl sx={{ display: "inline-block" }} size="small" color={"secondary"}>
<TextField
select
label={"Syntax"}
margin={"dense"}
size={"small"}
style={{display: "inline-block", width: "100%",}}
value={mode}
sx={{padding: 0}}
onChange={onChangeMode}
>
{
@@ -169,7 +176,7 @@ const DisplayText = ({agent_file_id, expand}) => {
<MenuItem key={"searchopt" + opt} value={opt}>{opt}</MenuItem>
))
}
</Select>
</TextField>
</FormControl>
<MythicStyledTooltip title={wrapText ? "Unwrap Text" : "Wrap Text"} >
<IconButton onClick={toggleWrapText} style={{}}>
@@ -19,8 +19,10 @@ import 'ace-builds/src-noconflict/mode-java';
import 'ace-builds/src-noconflict/mode-javascript';
import {MythicStyledTooltip} from "../../MythicComponents/MythicStyledTooltip";
import MenuItem from '@mui/material/MenuItem';
import Select from '@mui/material/Select';
import TextField from '@mui/material/TextField';
import { IconButton } from '@mui/material';
import UnfoldMoreIcon from '@mui/icons-material/UnfoldMore';
import UnfoldLessIcon from '@mui/icons-material/UnfoldLess';
const MaxRenderSize = 2000000;
export const ResponseDisplayPlaintext = (props) =>{
@@ -28,6 +30,7 @@ export const ResponseDisplayPlaintext = (props) =>{
const [plaintextView, setPlaintextView] = React.useState("");
const [mode, setMode] = React.useState("html");
const [wrapText, setWrapText] = React.useState(true);
const [showOptions, setShowOptions] = React.useState(false);
useEffect( () => {
if(props.plaintext.length > MaxRenderSize){
snackActions.warning("Response too large (> 2MB), truncating the render. Download task output to view entire response.");
@@ -48,30 +51,48 @@ export const ResponseDisplayPlaintext = (props) =>{
const toggleWrapText = () => {
setWrapText(!wrapText);
}
const onChangeShowOptions = (e) => {
setShowOptions(!showOptions);
}
return (
<div style={{display: "flex", height: "100%", flexDirection: "column"}}>
<div>
<FormControl sx={{ width: "20%", display: "inline-block" }} size="small">
<Select
style={{display: "inline-block", width: "100%"}}
value={mode}
onChange={onChangeMode}
>
{
modeOptions.map((opt, i) => (
<MenuItem key={"searchopt" + opt} value={opt}>{opt}</MenuItem>
))
}
</Select>
</FormControl>
<MythicStyledTooltip title={wrapText ? "Unwrap Text" : "Wrap Text"} >
<IconButton onClick={toggleWrapText} style={{}}>
<WrapTextIcon color={wrapText ? "success" : "secondary"}
style={{cursor: "pointer"}}
/>
</IconButton>
</MythicStyledTooltip>
{showOptions &&
<div style={{display: "inline-flex", flexDirection: "row"}}>
<FormControl sx={{ display: "inline-block" }} size="small">
<TextField
label={"Syntax"}
select
margin={"dense"}
size={"small"}
style={{display: "inline-block", width: "100%"}}
value={mode}
onChange={onChangeMode}
>
{
modeOptions.map((opt, i) => (
<MenuItem key={"searchopt" + opt} value={opt}>{opt}</MenuItem>
))
}
</TextField>
</FormControl>
<MythicStyledTooltip title={wrapText ? "Unwrap Text" : "Wrap Text"} >
<IconButton onClick={toggleWrapText} style={{}}>
<WrapTextIcon color={wrapText ? "success" : "secondary"}
style={{cursor: "pointer"}}
/>
</IconButton>
</MythicStyledTooltip>
</div>
}
<div style={{height: "1px", width: "100%", display: "flex", zIndex: 1, justifyContent: "space-around", backgroundColor: theme.palette.secondary.main}}>
{showOptions &&
<UnfoldLessIcon onClick={onChangeShowOptions} style={{cursor: "pointer", position: "relative", top: "-8px"}} />
}
{!showOptions &&
<UnfoldMoreIcon onClick={onChangeShowOptions} style={{cursor: "pointer", position: "relative", top: "-7px"}} />
}
</div>
<div style={{display: "flex", flexGrow: 1, height: "100%"}}>
<AceEditor
mode={mode}
+1 -1
View File
@@ -15,7 +15,7 @@ import jwt_decode from 'jwt-decode';
import {meState} from './cache';
export const mythicVersion = "3.2.17";
export const mythicUIVersion = "0.1.62";
export const mythicUIVersion = "0.1.63";
let fetchingNewToken = false;
+20 -1
View File
@@ -1 +1,20 @@
FROM ghcr.io/its-a-feature/mythic_cli:v0.0.3.10
#FROM itsafeaturemythic/mythic_go_base:latest
FROM golang:1.21-alpine
WORKDIR /usr/src/app
ARG GOPROXY=proxy.golang.org
ARG GO111MODULE
RUN go env -w GOPROXY=${GOPROXY}
RUN go env -w GO111MODULE=${GO111MODULE}
COPY ["src/", "."]
RUN apk add --no-cache make
RUN make build_all
FROM alpine
COPY --from=0 /usr/src/app/mythic-cli_linux /mythic-cli_linux
COPY --from=0 /usr/src/app/mythic-cli_macos /mythic-cli_macos
+15 -5
View File
@@ -10,16 +10,26 @@ default: build_linux ;
export
build_binary_linux:
copy_binary_linux:
docker run -v ${LOCAL_PATH}/copy_file/:/copy_file/ --rm ${BUILDER_IMAGE} sh -c "cp /mythic-cli_linux /copy_file/mythic-cli"
mv ./copy_file/${BINARY_NAME} . && rm -rf ./copy_file && chmod +x ${BINARY_NAME}
build_binary_macos:
copy_binary_macos:
docker run -v ${LOCAL_PATH}/copy_file/:/copy_file/ --rm ${BUILDER_IMAGE} sh -c "cp /mythic-cli_macos /copy_file/mythic-cli"
mv ./copy_file/${BINARY_NAME} . && rm -rf ./copy_file && chmod +x ${BINARY_NAME}
build_binary_macos_local:
build_local:
cd src && go build -o ../../mythic-cli .
build_linux: build_binary_linux
build_macos: build_binary_macos
build_linux_docker:
docker build -t mythic-cli-builder -f Dockerfile .
docker run -v ${LOCAL_PATH}/copy_file/:/copy_file/ --rm mythic-cli-builder sh -c "cp /mythic-cli_linux /copy_file/mythic-cli"
mv ./copy_file/${BINARY_NAME} . && rm -rf ./copy_file && chmod +x ${BINARY_NAME}
build_macos_docker:
docker build -t mythic-cli-builder -f Dockerfile .
docker run -v ${LOCAL_PATH}/copy_file/:/copy_file/ --rm mythic-cli-builder sh -c "cp /mythic-cli_macos /copy_file/mythic-cli"
mv ./copy_file/${BINARY_NAME} . && rm -rf ./copy_file && chmod +x ${BINARY_NAME}
build_linux: copy_binary_linux
build_macos: copy_binary_macos
@@ -1,15 +1,15 @@
{
"files": {
"main.css": "/new/static/css/main.00d51b79.css",
"main.js": "/new/static/js/main.bdecbcc2.js",
"main.js": "/new/static/js/main.8da14125.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.bdecbcc2.js.map": "/new/static/js/main.bdecbcc2.js.map"
"main.8da14125.js.map": "/new/static/js/main.8da14125.js.map"
},
"entrypoints": [
"static/css/main.00d51b79.css",
"static/js/main.bdecbcc2.js"
"static/js/main.8da14125.js"
]
}
+1 -1
View File
@@ -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>
<!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>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long