|
1 | | -# AGENT.md |
| 1 | +# AGENT.md — C2Core |
2 | 2 |
|
3 | | -## Building the modules |
| 3 | +## Purpose |
4 | 4 |
|
5 | | -This guide provides the steps necessary to set up and build the modules, from modules directory, for the [C2Core](https://github.com/maxDcb/C2Core) project. |
| 5 | +You are an expert C++/CMake contributor tasked with maintaining, and expending **C2Core**. |
6 | 6 |
|
7 | | -This document assumes you are only interested in building the modules and running the associated tests. |
| 7 | +- Keep changes portable (Linux/Windows), and covered by tests. |
| 8 | +- Match the project’s coding style and folder layout already in use. |
8 | 9 |
|
9 | | -The code is written in **modern C++**, uses **CMake** as its build system, and expects external dependencies to be placed in specific subdirectories. |
10 | | - |
11 | | ---- |
12 | | - |
13 | | -### 📁 Step-by-Step Instructions |
14 | | - |
15 | | -1. **Clone the repository** and move to the `modules` directory: |
16 | | - |
17 | | - ```bash |
18 | | - git clone https://github.com/maxDcb/C2Core.git |
19 | | - cd C2Core/modules |
20 | | - ``` |
21 | | - |
22 | | -2. **Create required directory structure**: |
23 | | - |
24 | | - ```bash |
25 | | - mkdir -p ModuleCmd/nlohmann |
26 | | - ``` |
27 | | - |
28 | | -3. **Download external dependencies**: |
29 | | - |
30 | | - * `nlohmann::json` (used for JSON parsing): |
31 | | - |
32 | | - ```bash |
33 | | - cd ~ |
34 | | - mkdir -p thirdParty/base64 |
35 | | - curl -L https://raw.githubusercontent.com/ReneNyffenegger/cpp-base64/82147d6d89636217b870f54ec07ddd3e544d5f69/base64.cpp -o thirdParty/base64/base64.cpp |
36 | | - cd modules |
37 | | - curl -o ModuleCmd/nlohmann/json.hpp https://raw.githubusercontent.com/maxDcb/C2TeamServer/refs/heads/master/thirdParty/nlohmann/json.hpp |
38 | | - ``` |
39 | | - |
40 | | - * `base64.h` (from cpp-base64): |
41 | | - |
42 | | - ```bash |
43 | | - curl -o ModuleCmd/base64.h https://raw.githubusercontent.com/ReneNyffenegger/cpp-base64/82147d6d89636217b870f54ec07ddd3e544d5f69/base64.h |
44 | | - ``` |
45 | | - |
46 | | -4. **Build the module** with CMake: |
47 | | - |
48 | | - ```bash |
49 | | - mkdir build |
50 | | - cd build |
51 | | - cmake -DWITH_TESTS=ON .. |
52 | | - make |
53 | | - ``` |
54 | | - |
55 | | ---- |
56 | | - |
57 | | -### ✅ Running the Tests |
58 | | - |
59 | | -Once the build completes, the test binaries will be available in the `modules/Tests ` directory. You can run them with: |
| 10 | +## Quick Start (Linux) |
60 | 11 |
|
61 | 12 | ```bash |
62 | | -./testsModuleName |
63 | | -``` |
64 | | - |
65 | | -These tests validate core functionality and encoding/decoding routines. You can also use ctest to launch all the tests. |
66 | | - |
67 | | -### 🚀 Workflow Hints |
68 | | - |
69 | | -The GitHub workflows in `.github/workflows/` mirror the exact commands used to |
70 | | -compile the modules and run the tests on both Linux and Windows. Refer to these |
71 | | -files if you need a quick reminder of the expected build steps. |
72 | | - |
73 | | -### 📜 Tracking Previous Work |
74 | | - |
75 | | -Test coverage has been steadily improved across the modules. Review the recent |
76 | | -commit history (`git log`) to see examples such as the addition of the MkDir |
77 | | -module tests and CI configuration. Checking the history can help you understand |
78 | | -what has already been addressed before starting a new task. |
79 | | - |
| 13 | +mkdir -p build && cd build |
| 14 | +cmake -DWITH_TESTS=ON .. |
| 15 | +cmake --build . -j |
80 | 16 |
|
| 17 | +ctest --output-on-failure |
| 18 | +``` |
0 commit comments