|
| 1 | +cmake_minimum_required(VERSION 3.16) |
| 2 | +project(C2Core LANGUAGES CXX) |
| 3 | + |
| 4 | +set(CMAKE_CXX_STANDARD 17) |
| 5 | +set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 6 | + |
| 7 | +include(FetchContent) |
| 8 | + |
| 9 | +# External libraries |
| 10 | +FetchContent_Declare( |
| 11 | + Dnscommunication |
| 12 | + GIT_REPOSITORY https://github.com/maxDcb/Dnscommunication.git |
| 13 | + GIT_TAG master |
| 14 | +) |
| 15 | +FetchContent_MakeAvailable(Dnscommunication) |
| 16 | + |
| 17 | +FetchContent_Declare( |
| 18 | + SocketHandler |
| 19 | + GIT_REPOSITORY https://github.com/maxDcb/libSocketHandler.git |
| 20 | + GIT_TAG master |
| 21 | +) |
| 22 | +FetchContent_MakeAvailable(SocketHandler) |
| 23 | + |
| 24 | +# PipeHandler and MemoryModule have platform-specific sources |
| 25 | +if(WIN32) |
| 26 | + FetchContent_Declare( |
| 27 | + PipeHandler |
| 28 | + GIT_REPOSITORY https://github.com/maxDcb/libPipeHandler.git |
| 29 | + GIT_TAG master |
| 30 | + ) |
| 31 | + FetchContent_Declare( |
| 32 | + MemoryModule |
| 33 | + GIT_REPOSITORY https://github.com/maxDcb/MemoryModule.git |
| 34 | + GIT_TAG master |
| 35 | + ) |
| 36 | +else() |
| 37 | + FetchContent_Declare( |
| 38 | + PipeHandler |
| 39 | + GIT_REPOSITORY https://github.com/maxDcb/C2TeamServer.git |
| 40 | + GIT_TAG master |
| 41 | + SOURCE_SUBDIR libs/libPipeHandlerDumy |
| 42 | + ) |
| 43 | + FetchContent_Declare( |
| 44 | + MemoryModule |
| 45 | + GIT_REPOSITORY https://github.com/maxDcb/C2TeamServer.git |
| 46 | + GIT_TAG master |
| 47 | + SOURCE_SUBDIR libs/libMemoryModuleDumy |
| 48 | + ) |
| 49 | +endif() |
| 50 | + |
| 51 | +FetchContent_MakeAvailable(PipeHandler) |
| 52 | +FetchContent_MakeAvailable(MemoryModule) |
| 53 | + |
| 54 | +FetchContent_Declare( |
| 55 | + SocksServer |
| 56 | + GIT_REPOSITORY https://github.com/maxDcb/libSocks5.git |
| 57 | + GIT_TAG master |
| 58 | +) |
| 59 | +FetchContent_MakeAvailable(SocksServer) |
| 60 | + |
| 61 | +# Header-only / source dependencies placed in thirdParty for relative includes |
| 62 | +set(BASE64_SRC_DIR ${CMAKE_SOURCE_DIR}/thirdParty/base64) |
| 63 | +FetchContent_Declare( |
| 64 | + base64 |
| 65 | + GIT_REPOSITORY https://github.com/ReneNyffenegger/cpp-base64.git |
| 66 | + GIT_TAG 82147d6d89636217b870f54ec07ddd3e544d5f69 |
| 67 | + SOURCE_DIR ${BASE64_SRC_DIR} |
| 68 | +) |
| 69 | +FetchContent_Populate(base64) |
| 70 | + |
| 71 | +set(DONUT_SRC_DIR ${CMAKE_SOURCE_DIR}/thirdParty/donut) |
| 72 | +FetchContent_Declare( |
| 73 | + donut |
| 74 | + GIT_REPOSITORY https://github.com/maxDcb/donut.git |
| 75 | + GIT_TAG master |
| 76 | + SOURCE_DIR ${DONUT_SRC_DIR} |
| 77 | +) |
| 78 | +FetchContent_Populate(donut) |
| 79 | + |
| 80 | +# Additional third party libraries |
| 81 | +FetchContent_Declare( |
| 82 | + httplib |
| 83 | + GIT_REPOSITORY https://github.com/yhirose/cpp-httplib.git |
| 84 | + GIT_TAG v0.14.1 |
| 85 | +) |
| 86 | +FetchContent_MakeAvailable(httplib) |
| 87 | + |
| 88 | +find_package(OpenSSL REQUIRED) |
| 89 | +add_library(openssl::openssl INTERFACE IMPORTED) |
| 90 | +target_link_libraries(openssl::openssl INTERFACE OpenSSL::SSL OpenSSL::Crypto) |
| 91 | + |
| 92 | +option(BUILD_TESTING "Build unit tests" ON) |
| 93 | +if(BUILD_TESTING) |
| 94 | + enable_testing() |
| 95 | + set(WITH_TESTS ON CACHE BOOL "" FORCE) |
| 96 | +endif() |
| 97 | + |
| 98 | +add_subdirectory(beacon/tests) |
| 99 | +add_subdirectory(listener/tests) |
| 100 | +add_subdirectory(modules) |
0 commit comments