mythic-cli
to install and run your C2 Profile, then Mythic will mount your Mythic/InstalledServices/[c2 profile name]
folder as /Mythic
inside of the Docker container as a volume. This means that any changes to the Mythic/InstalledServices/[c2 profile name]
folder that happen on disk will be mirrored inside of the Docker container.config.json
, that the user can edit from the Mythic UI.
config.json
- this is a JSON file that exposes any configuration parameters that you want to expose to the user (such as which port to open up, do you need SSL, etc).
server_binary_path
- this is the actual program that Mythic executes when you “start” a C2 Profile. This file can be whatever you want as long as it’s executable.
sudo ./mythic-cli install github https://github.com/C2Profiles/[profile name]
. However, since you already have the code and folder structure in your Mythic/InstalledServices
folder, we can just ‘tell’ Mythic that it exists. You can do this via sudo ./mythic-cli add [profile name]
. You can then start just that one container with sudo ./mythic-cli start [profile name]
. When the container starts, a few things happen:
main.py
or main
depending on Python or GoLang
rabbitmq_config.json
as well as environment variables passed in are processed and used to start the service. It then processes all of the files within the c2_functions
folder to look for your C2 Profile class (You’ll notice here that your class extends the C2Profile class). Once it finds that class, it gets a dictionary representation of all of that information (C2 profile name, parameters, etc) and then connects to RabbitMQ to send that data to Mythic.
http://MythicServerHost:MythicServerPort/agent_message
endpoint where MythicServerHost
and MythicServerPort
are both available via environment variable is good enough. You’ll get an immediate result back from that which your C2 profile should hand back to the agent.
Mythic will try to automatically start your server file when the container starts. This same file is what gets executed when you click to “start” the profile in the UI.
Every Docker container has environment variables, MYTHIC_SERVER_HOST
which points to 127.0.0.1
by default and MYTHIC_SERVER_PORT
which points to 17443
by default. This information is pulled from the main /Mythic/.env
file. So, if you change Mythic’s main UI to HTTP on port 7444, then each C2 Docker container’s MYTHIC_SERVER_PORT
environment variable will update. This allows your code within the docker container to always know where to forward requests so that the main Mythic server can process them.
message
is typically an encrypted blob, but could be anything.task_id
, there is some functionality they won’t be able to leverage.
custom_rpc_functions
, which are dictionaries of key
-value
pairs (much like the completion functions) where the key
is the name of the function that a remote services can call, and the value
is the actual function itself. These functions have the following format:
incomingMsg.ServiceRPCFunctionArguments
and the resulting data goes back through the Result
key.