Skip to content

Commit

Permalink
ui tweak and rabbitmq update for retries
Browse files Browse the repository at this point in the history
  • Loading branch information
its-a-feature committed Feb 20, 2025
1 parent 734eaba commit 1390b4e
Show file tree
Hide file tree
Showing 17 changed files with 78 additions and 54 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-rc45] - 2025-02-20

### Changed

- Updated rabbitmq with retries for failed tasks before aborting

## [3.3.1-rc44] - 2025-02-18

### Changed
Expand Down
8 changes: 8 additions & 0 deletions MythicReactUI/CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ 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.3.11] - 2025-02-20

### Changed

- Updated the background coloring for images to make it a bit easier to see text on harsh background
- Updated default font family
- Updated command and parameter search to include original and updated command names for aliases

## [0.3.10] - 2025-02-13

### Changed
Expand Down
2 changes: 1 addition & 1 deletion MythicReactUI/src/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const menuOpen = makeVar(false);
export const alertCount = makeVar(0);
export const operatorSettingDefaults = {
fontSize: 12,
fontFamily: "Verdana",
fontFamily: "Verdana, Arial, sans-serif",
showMedia: true,
hideUsernames: false,
showIP: false,
Expand Down
8 changes: 6 additions & 2 deletions MythicReactUI/src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ export function App(props) {
</StyledEngineProvider>
)
}
const background = theme.palette.background.image !== null ? {
background: "linear-gradient(" + theme.palette.background.default + "99" + "," + theme.palette.background.default + "99" + ")," + theme.palette.background.image,
} : {
backgroundColor: theme.palette.background.default
};
return (
<StyledEngineProvider injectFirst>
<ThemeProvider theme={theme}>
Expand All @@ -202,8 +207,7 @@ export function App(props) {
wordBreak: "break-all", flexDirection: "column", justifyContent: "center"}}
pauseOnFocusLoss={false} />
<div style={{ maxHeight: '100%', height: '100%', display: 'flex', flexDirection: 'row', maxWidth: "100%", width:"100%",
backgroundImage: theme.palette.background.image !== null ? theme.palette.background.image : "",
backgroundSize: "contain"}}>
...background}}>

{openRefreshDialog &&
<MythicDialog fullWidth={true} maxWidth="sm" open={openRefreshDialog}
Expand Down
2 changes: 1 addition & 1 deletion MythicReactUI/src/components/TopAppBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ export function TopAppBar(props) {
{me?.user?.current_operation_id === 0 ? (
<Link style={{display: "inline-flex", alignItems: "center", paddingRight: "10px", color: "#f84d4d",
fontWeight: "bold",}} to="/new/operations">
{"CLICK HERE TO SET OPERATION!"}
{"NO OPERATION!"}
</Link>
) : (
<>
Expand Down
4 changes: 2 additions & 2 deletions MythicReactUI/src/components/pages/Search/SearchTabTasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ query commandQuery($search: String!, $offset: Int!, $fetchLimit: Int!, $status:
const commandAndParameterSearch = gql`
${taskingDataFragment}
query parametersQuery($search: String!, $offset: Int!, $fetchLimit: Int!, $status: String!, $host: String!) {
task_aggregate(distinct_on: id, order_by: {id: desc}, where: {status: {_ilike: $status}, callback: {host: {_ilike: $host}}, _or: [{original_params: {_ilike: $search}}, {command_name: {_ilike: $search}}]}) {
task_aggregate(distinct_on: id, order_by: {id: desc}, where: {status: {_ilike: $status}, callback: {host: {_ilike: $host}}, _or: [{original_params: {_ilike: $search}}, {command: {cmd: {_ilike: $search}}}, {command_name: {_ilike: $search}}]}) {
aggregate {
count(columns: id)
}
}
task(limit: $fetchLimit, distinct_on: id, offset: $offset, order_by: {id: desc}, where: {status: {_ilike: $status}, callback: {host: {_ilike: $host}}, _or: [{original_params: {_ilike: $search}}, {command_name: {_ilike: $search}}]}) {
task(limit: $fetchLimit, distinct_on: id, offset: $offset, order_by: {id: desc}, where: {status: {_ilike: $status}, callback: {host: {_ilike: $host}}, _or: [{original_params: {_ilike: $search}}, {command: {cmd: {_ilike: $search}}}, {command_name: {_ilike: $search}}]}) {
...taskData
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const interactTypeOptions = [
{value: "interactConsole", display: "Console Like"}
];
const commonFontFamilies = [
"Verdana",
operatorSettingDefaults.fontFamily,
"-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,\"Helvetica Neue\",Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\"",
"Monaco"
]
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';
import {getSkewedNow} from "./components/utilities/Time";

export const mythicUIVersion = "0.3.10";
export const mythicUIVersion = "0.3.11";

let fetchingNewToken = false;

Expand Down
3 changes: 2 additions & 1 deletion MythicReactUI/src/themes/GlobalStyles.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createGlobalStyle} from "styled-components"
// hex transparencies https://gist.github.com/lopspower/03fb1cc0ac9f32ef38f4
export const GlobalStyles = createGlobalStyle`
body {
margin: 0
Expand Down Expand Up @@ -197,7 +198,7 @@ tspan {
box-sizing: border-box;
justify-content: space-between;
user-select: none;
background-color: ${(props) => props.theme.tableHeader};
background-color: ${(props) => props.theme.tableHeader} !important;
&:first-child-of-type {
border-left: 1px solid ${(props) => props.theme.tableHover};
}
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.1-rc44
3.3.1-rc45
2 changes: 1 addition & 1 deletion mythic-docker/src/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.1-rc44
3.3.1-rc45
75 changes: 40 additions & 35 deletions mythic-docker/src/rabbitmq/utils_rabbitmq_routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,95 +288,100 @@ func (r *rabbitMQConnection) SendMessage(exchange string, queue string, correlat

}
func (r *rabbitMQConnection) SendRPCMessage(exchange string, queue string, body []byte, exclusiveQueue bool) ([]byte, error) {
if conn, err := r.GetConnection(); err != nil {
conn, err := r.GetConnection()
if err != nil {
return nil, err
} else if ch, err := conn.Channel(); err != nil {
}
ch, err := conn.Channel()
if err != nil {
logging.LogError(err, "Failed to open rabbitmq channel")
return nil, err
} else if err := ch.Confirm(false); err != nil {
}
err = ch.Confirm(false)
if err != nil {
logging.LogError(err, "Channel could not be put into confirm mode")
ch.Close()
return nil, err
} else if err = ch.ExchangeDeclare(
}
err = ch.ExchangeDeclare(
exchange, // exchange name
"direct", // type of exchange, ex: topic, fanout, direct, etc
true, // durable
true, // auto-deleted
false, // internal
false, // no-wait
nil, // arguments
); err != nil {
)
if err != nil {
logging.LogError(err, "Failed to declare exchange", "exchange", exchange, "exchange_type", "direct", "retry_wait_time", RETRY_CONNECT_DELAY)
return nil, err
} else if msgs, err := ch.Consume(
}
msgs, err := ch.Consume(
"amq.rabbitmq.reply-to", // queue name
"", // consumer
true, // auto-ack
exclusiveQueue, // exclusive
false, // no local
false, // no wait
nil, // args
); err != nil {
)
if err != nil {
logging.LogError(err, "Failed to start consuming for RPC replies")
ch.Close()
return nil, err
} else {
defer ch.Close()
}
defer ch.Close()
confirmChannel := ch.NotifyPublish(make(chan amqp.Confirmation, 1))
notifyReturnChannel := ch.NotifyReturn(make(chan amqp.Return, 1))
for attempt := 0; attempt < 3; attempt++ {
msg := amqp.Publishing{
ContentType: "application/json",
CorrelationId: uuid.NewString(),
Body: body,
ReplyTo: "amq.rabbitmq.reply-to",
}
if err = ch.Publish(
err = ch.Publish(
exchange, // exchange
queue, // routing key
true, // mandatory
false, // immediate
msg, // publishing
); err != nil {
)
if err != nil {
logging.LogError(err, "there was an error publishing a message", "queue", queue)
return nil, err
time.Sleep(RPC_TIMEOUT)
continue
}
select {
case ntf := <-ch.NotifyPublish(make(chan amqp.Confirmation, 1)):
case ntf := <-confirmChannel:
if !ntf.Ack {
err := errors.New("Failed to deliver message, not ACK-ed by receiver")
logging.LogError(err, "failed to deliver message to exchange/queue, notifyPublish")
return nil, err
time.Sleep(RPC_TIMEOUT)
continue
}
case ret := <-ch.NotifyReturn(make(chan amqp.Return)):
err := errors.New(getMeaningfulRabbitmqError(ret))
return nil, err
case ret := <-notifyReturnChannel:
err = errors.New(getMeaningfulRabbitmqError(ret))
time.Sleep(RPC_TIMEOUT)
continue
case <-time.After(RPC_TIMEOUT):
err := errors.New("message delivery confirmation timed out in SendRPCMessage")
err = errors.New("message delivery confirmation timed out in SendRPCMessage")
logging.LogError(err, "message delivery confirmation to exchange/queue timed out", "queue", queue)
return nil, err
continue
}
//logging.LogDebug("Sent RPC message", "queue", queue)
select {
case m := <-msgs:
//logging.LogDebug("Got RPC Reply", "queue", queue)
return m.Body, nil
case <-time.After(RPC_TIMEOUT):
logging.LogError(nil, "Timeout reached waiting for RPC reply")
return nil, errors.New("Timeout reached waiting for RPC reply")
err = errors.New("Message delivery confirmation timed out")
logging.LogError(err, "message delivery confirmation to exchange/queue timed out")
continue
}
}

/*
_, err = ch.QueueDeclarePassive(
queue, // name, queue
false, // durable
true, // delete when unused
true, // exclusive
false, // no-wait
nil, // arguments
)
if err != nil {
logging.LogError(err, "Failed to declare queue, RPC endpoint doesn't exist", "retry_wait_time", RETRY_CONNECT_DELAY)
return nil, err
}*/
logging.LogError(err, "failed 3 times")
return nil, err
}
func (r *rabbitMQConnection) ReceiveFromMythicDirectExchange(exchange string, queue string, routingKey string, handler QueueHandler, exclusiveQueue bool) {
// exchange is a direct exchange
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,17 +1,17 @@
{
"files": {
"main.css": "/new/static/css/main.602591e6.css",
"main.js": "/new/static/js/main.a6a04f67.js",
"main.js": "/new/static/js/main.247530d0.js",
"static/media/mythic-red.png": "/new/static/media/mythic-red.203468a4e5240d239aa0.png",
"static/media/graphql.png": "/new/static/media/graphql.8f15978b39b0870a9f0e.png",
"static/media/Mythic_Logo.svg": "/new/static/media/Mythic_Logo.6842c911bebe36d6f83fc7ced4a2cd99.svg",
"static/media/mythic_red_small.svg": "/new/static/media/mythic_red_small.793b41cc7135cdede246661ec232976b.svg",
"index.html": "/new/index.html",
"main.602591e6.css.map": "/new/static/css/main.602591e6.css.map",
"main.a6a04f67.js.map": "/new/static/js/main.a6a04f67.js.map"
"main.247530d0.js.map": "/new/static/js/main.247530d0.js.map"
},
"entrypoints": [
"static/css/main.602591e6.css",
"static/js/main.a6a04f67.js"
"static/js/main.247530d0.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.a6a04f67.js"></script><link href="/new/static/css/main.602591e6.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.247530d0.js"></script><link href="/new/static/css/main.602591e6.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 1390b4e

Please sign in to comment.