Skip to main content
This section details how to build custom build a Merlin Agent using the Make file.
Merlin is distributed with pre-compiled agent binaries for all major platforms in the data/bin directory.

Basic

The provided Make file can be used to build a new agent from source. It is recommended that you first use go get github.com/Ne0nd0g/merlin-agent to pull a copy of the Merlin source code to the host. Move into the Merlin root directory where the Make file is located.
  • Windows agent: make windows
  • Linux agent: make linux
  • macOS agent: make darwin
  • MIPS agent: make mips
  • ARM agent: make arm

Advanced

Use the provided Make file to build a Merlin Agent with hard coded values. This removes the need for an operator to use commandline arguments and allows the Agent to simply be executed. The table below shows configurable compile options View the Listeners page for additional information on specific listener configurable options. An example of creating a new Linux HTTP agent that is using domain fronting through https://merlin.com/c2endpoint.php using a PSK of SecurePassword1: make linux URL=https://merlin.com:443/c2endpoint.php HOST=myendpoint.azureedge.net PROTO=https PSK=SecurePassword1

Build Tags

By default, the Merlin Agent is built with all available features and components compiled in. Build tags can be used to control what features are compiled into the agent to reduce the size of the binary or to restrict the agent’s capabilities. When any build tag is included, the agent will ONLY include that feature and nothing else. For example, if ONLY the http tag is provided, the SMB, TCP, and UDP clients will not be included. The following build tags are available:

Windows Agent

The Windows Merlin Agent executable is compiled as a GUI application instead of console application. The Merlin Agent does not have a GUI component. The reason this is used is so that the Merlin Agent window disappears after it is executed. This behavior is intentional so that the user will not see the application window. This is done with the LDFLAGS when building the agent using the -H=windowsgui option as shown here This causes problems when a user WANTS to see the Merlin Agent verbose or debug output. To view Merlin verbose/debug output, use the Makefile windows-debug target (e.g., make windows-debug)

Cross-Compiling

The Merlin agent and server can be cross-compiled to any operating system or architecture. A list of golang supported operating systems and architectures can be found here: https://golang.org/doc/install/source#environment