mirror of
https://github.com/maxDcb/C2Core
synced 2026-06-08 15:48:01 +00:00
2.2 KiB
2.2 KiB
AGENT.md — C2Core
Purpose
You are an expert C++/CMake contributor tasked with maintaining, and expending C2Core.
- Keep changes portable (Linux/Windows), and covered by tests.
- Match the project’s coding style and folder layout already in use.
Build Context
C2Core is consumed from the parent repository and no longer has a top-level standalone CMakeLists.txt.
- The parent project owns the top-level
project(...), release layout, and vendor source directories. - Tests are enabled by the parent through
C2CORE_BUILD_TESTS. - The parent is expected to provide
thirdParty/base64as a real CMake target namedc2_base64, andthirdParty/donut, or overrideC2_BASE64_SOURCE_DIRandC2_DONUT_SOURCE_DIR. - The parent is expected to provide imported targets for external dependencies used by
core, notablynlohmann_json::nlohmann_jsonandLibssh2::libssh2. - In
C2Implant, those external dependencies come from Conan. Other parents may provide equivalent imported targets differently.
Platform Duality
core/ contains shared sources, but beacon transport code is not symmetric across platforms.
- On Windows beacon-side code, HTTP/HTTPS and GitHub transports use WinAPI facilities such as
WinHTTP,WinCrypt, andBCrypt. - On Linux, the equivalent transport code may rely on
httplibandOpenSSL. - Do not blindly link Linux transport dependencies on Windows targets just because the shared source file lives under
core/. BeaconHttpLibandBeaconGithubLibmust not requireopenssl::opensslorhttplib::httplibon Windows unless the Windows source path is explicitly changed to use them too.- When editing
core/beacon/CMakeLists.txt, keep transport-specific link dependencies conditional on platform. - Apply the same caution to tests: if a test only covers Linux transport plumbing, guard its link dependencies with platform checks.
Dependency Rules
- Link shared base64 users to
c2_base64; do not compilebase64.cppdirectly from multiplecoretargets. - Link SSH users to
Libssh2::libssh2. The parent may alias this to Conan's package target when necessary. - Do not make
coredepend on Conan directly. Conan is a parent-level implementation detail inC2Implant.