First Steps
What are the first things to do when creating a new payload type in Mythic?

So you want to make a new Payload Type

The first step is to copy the /Mythic/Example_Payload_Type folder into the /Mythic/Payload_Types/ folder and rename it to match the name of your new agent. For the purposes here, let's assume your new agent is called MyNewAgent. So you'd copy that directory as /Mythic/Payload_Types/MyNewAgent.
The next thing you need to do is edit the builder file (https://github.com/its-a-feature/Mythic/blob/master/Example_Payload_Type/mythic/agent_functions/builder.py) to reflect the information for your new agent. Specifically, you'll want to edit it like:
1
from mythic_payloadtype_container.MythicCommandBase import *
2
from mythic_payloadtype_container.PayloadBuilder import *
3
import asyncio
4
import os
5
from distutils.dir_util import copy_tree
6
import tempfile
7
8
# define your payload type class here, it must extend the PayloadType class though
9
class MyNewAgent(PayloadType):
10
11
name = "MyNewAgent" # name that would show up in the UI
12
file_extension = "exe" # default file extension to use when creating payloads
13
author = "@YourHandleHere" # author of the payload type
14
supported_os = [ # supported OS and architecture combos
15
SupportedOS.Windows, SupportedOS.Linux # update this list with all the OSes your agent supports
16
]
17
wrapper = False # does this payload type act as a wrapper for another payloads inside of it?
18
# if the payload supports any wrapper payloads, list those here
19
wrapped_payloads = [] # ex: "service_wrapper"
20
note = "Any note you want to show up about your payload type in the UI"
21
supports_dynamic_loading = False # setting this to True allows users to only select a subset of commands when generating a payload
22
build_parameters = {
23
# these are all the build parameters that will be presented to the user when creating your payload
24
# we'll leave this blank for now
25
}
26
# the names of the c2 profiles that your agent supports
27
c2_profiles = ["http"]
28
# after your class has been instantiated by the mythic_service in this docker container and all required build parameters have values
29
# then this function is called to actually build the payload
30
async def build(self) -> BuildResponse:
31
# this function gets called to create an instance of your payload
32
resp = BuildResponse(status=BuildStatus.Error)
33
return resp
Copied!
More information on each component in the file can be found in Payload Type Info. Now you can run sudo ./mythic-cli payload add MyNewAgent and sudo ./mythic-cli payload start MyNewAgent and you'll see the container build, start, and you'll see it sync with the Mythic server (more about that process at Container Syncing).
Congratulations! You now have a payload type that Mythic recognizes!
Now you'll want to actually configure your Docker Container, look into building your agent, how to declare new commands, how to process tasking to these commands, and finally hooking your agent into all the cool features of Mythic.
Last modified 7mo ago
Copy link