Skip to content

7 ‐ Build

Maxime dcb edited this page Jan 16, 2025 · 5 revisions

Build

The full project is composed of three repositories: C2TeamServer, C2Implant, and C2LinuxImplant.

  • C2TeamServer is built on Linux using CMake and g++. It uses Conan as a dependency manager.
  • C2Implant is built on Windows using CMake and the Microsoft Visual C++ (MSVC) compiler. It does not use any dependency manager.
  • C2LinuxImplant is built on Linux using CMake and g++. It does not use any dependency manager.

Moreover, the TeamServer and the Client GUI are both included in C2TeamServer for convenience, as they share a common gRPC messaging system.

Once everything is compiled, all the different parts must be placed in the Release folder with the correct folder hierarchy, which can be configured in 'TeamServerConfig.json'. This ensures that the TeamServer can locate all components during execution.

Sumbodule & External Projects:

Build

The following dependencies must be installed before compiling:

sudo apt install gcc-mingw-w64
sudo apt install g++-mingw-w64
sudo apt install golang-cfssl
sudo apt install cmake 

pip3 install pycryptodome
pip3 install conan==2.1.0
pip3 install grpcio==1.66.1
pip3 install PyQt5
pip3 install pyqtdarktheme
pip3 install protobuf==5.27.0

conan profile detect

# getting the source
git clone https://github.com/maxDcb/C2TeamServer.git
cd C2TeamServer
git submodule update --init

# Compiling: The first compilation may take some time as Conan might need to compile the dependencies, depending on your Conan configuration.
mkdir build
cd build
cmake .. -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=./conan_provider.cmake
make -j4

The TeamServer binary is copied to ./Release/TeamServer along with the default certificate. The Client is copied to ./Release/Client with the messaging system and the default certificate. The Linux TeamServer version of the modules is also compiled and copied to ./Release/Modules. These modules should be placed in the TeamServerModulesDirectoryPath, which has a default value of ./Release/TeamServerModules. They are loaded when the TeamServer starts.

Build Beacons & Modules

Sumbodule & External Projects:

Build the Windows Beacons and Modules

git clone https://github.com/maxDcb/C2Implant.git
cd C2Implant
git submodule update --init   
mkdir buildWindows  
cd buildWindows 

Windows x64

Within "x64 Native Tools Command Prompt for VS" console:

# Without tests and logs  
cmake  -G "Visual Studio 17 2022" ..   
# With tests and logs  
cmake  -G "Visual Studio 17 2022" -DWITH_TESTS=ON ..   
msbuild .\C2Implant.sln /property:Configuration=Release -m  

or it should be possible to compile the generated C2.sln in Release mode with Visual Studio. Configure the Runtime Library to Multi-threaded (/MT) and set the build configuration to Release.

Windows x86

cmake  -G "Visual Studio 17 2022" -A "Win32" ..   
msbuild .\C2Implant.sln /property:Configuration=Release /p:Platform=Win32 -m  

Production

Beacons are in: "Release\Beacons"
Modules DLL in: "Release\Modules"

These artifacts should be placed in the WindowsModulesDirectoryPath and WindowsBeaconsDirectoryPath, which have default values of ./Release/WindowsModules and ./Release/WindowsBeacons, respectively, in the TeamServer context, to be used by the TeamServer during execution.

Build the Linux Beacons and Modules

git clone https://github.com/maxDcb/C2LinuxImplant.git
cd C2LinuxImplant
git submodule update --init   
mkdir build  
cd build 
cmake ..
make -j4

Production

Beacons are in: "Release\Beacons"
Modules DLL in: "Release\Modules"

These artifacts should be placed in the LinuxModulesDirectoryPath and LinuxBeaconsDirectoryPath, which have default values of ./Release/LinuxModules and ./Release/LinuxBeacons, respectively, in the TeamServer context, to be used by the TeamServer during execution.

Clone this wiki locally