Skip to content

Commit

Permalink
Project fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MEhrn00 committed Aug 5, 2024
1 parent fcb1faf commit 64ddfcf
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 36 deletions.
59 changes: 28 additions & 31 deletions Payload_Type/thanatos/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,41 @@
# Build the Mythic server side code
FROM docker.io/library/golang:1.22-alpine as mythic-builder
### Image for building the server binary
FROM docker.io/library/golang:1.22-alpine as builder

RUN apk update \
&& apk add binutils \
&& apk add \
binutils \
make \
protoc \
git \
&& apk cache clean

RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@latest

RUN mkdir -p /usr/local/share/app
WORKDIR /usr/local/share/app

COPY mythic .
COPY go.mod go.mod
COPY go.sum go.sum

COPY Makefile Makefile
COPY protobuf protobuf

COPY cmd cmd
COPY pkg pkg

RUN go mod download
RUN make protobuf
RUN go mod tidy
RUN go build -ldflags='-extldflags=-static' -o mythic-server .
RUN strip -s mythic-server
RUN make GOFLAGS=-ldflags=-extldflags=-static server
RUN strip -s server

# Pull in the base image for the payload builder

### Image for running the server
FROM docker.io/library/debian:bookworm-slim

# Install required system packages
COPY --from=builder /usr/local/share/app/server /usr/local/bin/thanatos-server
RUN chmod +x /usr/local/bin/thanatos-server

RUN dpkg --add-architecture i386 && \
apt-get update -y && apt-get install -y \
make \
Expand All @@ -32,19 +49,6 @@ RUN dpkg --add-architecture i386 && \

WORKDIR /tmp

# Install sccache
ENV SCCACHE_VERSION v0.7.4
RUN curl -L \
"https://github.com/mozilla/sccache/releases/download/${SCCACHE_VERSION}/sccache-${SCCACHE_VERSION}-x86_64-unknown-linux-musl.tar.gz" \
-o sccache-${SCCACHE_VERSION}-x86_64-unknown-linux-musl.tar.gz
RUN tar xf sccache-${SCCACHE_VERSION}-x86_64-unknown-linux-musl.tar.gz
RUN mv sccache-${SCCACHE_VERSION}-x86_64-unknown-linux-musl/sccache /usr/bin/sccache
RUN chmod +x /usr/bin/sccache
RUN rm -rf sccache-${SCCACHE_VERSION}-x86_64-unknown-linux-musl
RUN rm -f sccache-${SCCACHE_VERSION}-x86_64-unknown-linux-musl.tar.gz
ENV SCCACHE_DIR /Mythic/.cache/sccache

# Install Rust with the required toolchains
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o rustup.sh \
&& sh rustup.sh -y \
--profile minimal \
Expand All @@ -56,20 +60,13 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o rustup.sh \

RUN rm -f rustup.sh

# Copy the cargo config.toml
COPY .docker/config.toml /root/.cargo/config.toml
ENV PATH=$PATH:/root/.cargo/bin

RUN mkdir /thanatos
WORKDIR /thanatos

COPY agent agent
COPY assets assets
COPY browserscripts browserscripts

RUN mkdir mythic
WORKDIR /thanatos/mythic
COPY mythic/assets assets
COPY mythic/browserscript browserscript

COPY --from=mythic-builder /opt/mythic/mythic-server .
RUN chmod +x ./mythic-server
CMD ["./mythic-server"]
CMD ["thanatos-server"]
2 changes: 1 addition & 1 deletion Payload_Type/thanatos/cmd/genconfig/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func main() {
}

if finfo.IsDir() {
return errors.New("Input path is a directory")
return errors.New("input path is a directory")
}

inputFile = filePath
Expand Down
2 changes: 1 addition & 1 deletion Payload_Type/thanatos/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.22
require (
github.com/MythicMeta/MythicContainer v1.3.6
github.com/google/uuid v1.6.0
golang.org/x/exp v0.0.0-20240213143201-ec583247a57a
google.golang.org/protobuf v1.32.0
)

Expand All @@ -30,7 +31,6 @@ require (
github.com/spf13/viper v1.18.2 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20240213143201-ec583247a57a // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
Expand Down
2 changes: 1 addition & 1 deletion Payload_Type/thanatos/pkg/commands/exit/exit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package exit
import (
"testing"

cmdtesting "github.com/MythicAgents/thanatos/commands/testing"
cmdtesting "github.com/MythicAgents/thanatos/pkg/commands/testing"
)

var testCases = []cmdtesting.TestCase{
Expand Down
2 changes: 1 addition & 1 deletion Payload_Type/thanatos/pkg/commands/sleep/sleep_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"math"
"testing"

cmdtesting "github.com/MythicAgents/thanatos/commands/testing"
cmdtesting "github.com/MythicAgents/thanatos/pkg/commands/testing"
)

var testCases = []cmdtesting.TestCase{
Expand Down
2 changes: 1 addition & 1 deletion Payload_Type/thanatos/pkg/commands/testing/test_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"reflect"
"testing"

"github.com/MythicAgents/thanatos/commands/utils"
"github.com/MythicAgents/thanatos/pkg/commands/utils"

agentstructs "github.com/MythicMeta/MythicContainer/agent_structs"
)
Expand Down

0 comments on commit 64ddfcf

Please sign in to comment.