-
Notifications
You must be signed in to change notification settings - Fork 32
7 ‐ 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.
- Donut: Create shellcode from PE files.
- cpp-httplib: Http and Https Listener.
- CoffLoader: Run object files from CS-Situational-Awareness-BOF.
- MemoryModule: Load DLL at runtime.
- UnmanagedPowerShell: Powershell for unmanaged code.
- cpp-base64: base64.
- json: json parser.
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.
- Donut: Creat shellcode from PE files.
- CoffLoader: Run object files from CS-Situational-Awareness-BOF.
- MemoryModule: Load DLL at runtime.
- UnmanagedPowerShell: Powershell for unmanager code.
- cpp-base64: base64.
- json: json parser.
- https://chocolatey.org/install
- choco install cmake --pre
git clone https://github.com/maxDcb/C2Implant.git
cd C2Implant
git submodule update --init
mkdir buildWindows
cd buildWindows
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.
cmake -G "Visual Studio 17 2022" -A "Win32" ..
msbuild .\C2Implant.sln /property:Configuration=Release /p:Platform=Win32 -m
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.
git clone https://github.com/maxDcb/C2LinuxImplant.git
cd C2LinuxImplant
git submodule update --init
mkdir build
cd build
cmake ..
make -j4
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.