From 976d5268cf73cbcc64b578225f9318426d6b647e Mon Sep 17 00:00:00 2001 From: Meatballs1 Date: Tue, 23 Sep 2025 19:51:23 +0100 Subject: [PATCH 1/8] Test workflow artifact build --- .github/workflows/build-clang.yml | 14 ++++++++------ .github/workflows/build-msvc.yml | 32 +++++++++++++++++++++++++------ 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-clang.yml b/.github/workflows/build-clang.yml index fa6a4ef1..8a356f8e 100644 --- a/.github/workflows/build-clang.yml +++ b/.github/workflows/build-clang.yml @@ -3,15 +3,14 @@ name: Build C3 (Clang) on: push: branches: [ master ] - pull_request: - branches: [ master ] +# pull_request: +# branches: [ master ] jobs: build: name: Build C3 (Clang) strategy: matrix: - platform: [x86, x64] configuration: [ClangDebug, ClangRwdi, ClangRelease] runs-on: windows-2022 @@ -31,8 +30,11 @@ jobs: - name: Dotnet restore run: msbuild Src/C3.sln "/t:restore" - - name: Build MSVC - run: msbuild Src/C3.sln /p:Platform=${{ matrix.platform }} /p:Configuration=${{ matrix.configuration }} "/t:GatewayConsoleExe;NodeRelayConsoleExe;NodeRelayDll;CebuLoader;ChannelLinter" + - name: Build MSVC x86 + run: msbuild Src/C3.sln /p:Platform=x86 /p:Configuration=${{ matrix.configuration }} "/t:GatewayConsoleExe;NodeRelayConsoleExe;NodeRelayDll;CebuLoader;ChannelLinter" + + - name: Build MSVC x64 + run: msbuild Src/C3.sln /p:Platform=x64 /p:Configuration=${{ matrix.configuration }} "/t:GatewayConsoleExe;NodeRelayConsoleExe;NodeRelayDll;CebuLoader;ChannelLinter" - name: Build WebService - run: dotnet publish -p:Platform=any -c ${{ matrix.configuration }} Src/WebController/Backend -o Bin/WebController + run: dotnet publish -p:Platform=any -c ${{ matrix.configuration }} Src/WebController/Backend -o Bin/WebController \ No newline at end of file diff --git a/.github/workflows/build-msvc.yml b/.github/workflows/build-msvc.yml index 86d5ff21..907315b6 100644 --- a/.github/workflows/build-msvc.yml +++ b/.github/workflows/build-msvc.yml @@ -11,8 +11,8 @@ jobs: name: Build C3 (MSVC) strategy: matrix: - platform: [x86, x64] - configuration: [Debug, ReleaseWithDebInfo, Release] + configuration: [Release] +# configuration: [Debug, ReleaseWithDebInfo, Release] runs-on: windows-2022 steps: @@ -31,9 +31,29 @@ jobs: - name: Dotnet restore run: msbuild Src/C3.sln "/t:restore" - - name: Build MSVC - run: msbuild Src/C3.sln /p:Platform=${{ matrix.platform }} /p:Configuration=${{ matrix.configuration }} "/t:GatewayConsoleExe;NodeRelayConsoleExe;NodeRelayDll;CebuLoader;ChannelLinter" - + - name: Build MSVC x86 + run: msbuild Src/C3.sln /p:Platform=x86 /p:Configuration=${{ matrix.configuration }} "/t:GatewayConsoleExe;NodeRelayConsoleExe;NodeRelayDll;CebuLoader;ChannelLinter" + + - name: Build MSVC x64 + run: msbuild Src/C3.sln /p:Platform=x64 /p:Configuration=${{ matrix.configuration }} "/t:GatewayConsoleExe;NodeRelayConsoleExe;NodeRelayDll;CebuLoader;ChannelLinter" + - name: Build WebService - run: dotnet publish -p:Platform=any -c ${{ matrix.configuration }} Src/WebController/Backend -o Bin/WebController + run: dotnet publish -p:Platform=any -c ${{ matrix.configuration }} Src/WebController/Backend -o Bin/WebController + + - name: Copy Gateway Configuration + run: copy Res\GatewayConfiguration.json Bin\GatewayConfiguration.json + + - name: Copy Web Controller Startup Script + run: copy StartWebController.cmd Bin\StartWebController.cmd + + - name: Copy Web Controller Restart Script + run: copy RestartWebController.cmd Bin\RestartWebController.cmd + + - name: Upload Release Artifacts + if: matrix.configuration == 'Release' + uses: actions/upload-artifact@v3 + with: + name: C3-${{ matrix.platform }}-Release + path: Bin/** + From 7dc16114d107dae8fffa289cabacd48d090a5afd Mon Sep 17 00:00:00 2001 From: Meatballs1 Date: Tue, 23 Sep 2025 19:55:58 +0100 Subject: [PATCH 2/8] Test github build --- .github/workflows/build-msvc.yml | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-msvc.yml b/.github/workflows/build-msvc.yml index 907315b6..9240fc7f 100644 --- a/.github/workflows/build-msvc.yml +++ b/.github/workflows/build-msvc.yml @@ -40,20 +40,25 @@ jobs: - name: Build WebService run: dotnet publish -p:Platform=any -c ${{ matrix.configuration }} Src/WebController/Backend -o Bin/WebController - - name: Copy Gateway Configuration - run: copy Res\GatewayConfiguration.json Bin\GatewayConfiguration.json - - name: Copy Web Controller Startup Script - run: copy StartWebController.cmd Bin\StartWebController.cmd - - - name: Copy Web Controller Restart Script - run: copy RestartWebController.cmd Bin\RestartWebController.cmd - + - name: Prepare Build Output Structure + run: | + mkdir Build + mkdir Build\Bin + mkdir Build\Bin\WebController + + copy StartWebController.cmd Build\StartWebController.cmd + copy RestartWebController.cmd Build\RestartWebController.cmd + copy Res\GatewayConfiguration.json Build\Bin\GatewayConfiguration.json + xcopy /E /I /Y Bin\WebController Build\Bin\WebController + xcopy /E /I /Y Bin Build\Bin + - name: Upload Release Artifacts if: matrix.configuration == 'Release' uses: actions/upload-artifact@v3 with: - name: C3-${{ matrix.platform }}-Release - path: Bin/** + name: C3-Release + path: Build/** + From ff42c28f64530f4200635f7807d7b994ce9f07ea Mon Sep 17 00:00:00 2001 From: Meatballs1 Date: Tue, 23 Sep 2025 19:57:43 +0100 Subject: [PATCH 3/8] Test github build --- .github/workflows/build-msvc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-msvc.yml b/.github/workflows/build-msvc.yml index 9240fc7f..0ccd2a3f 100644 --- a/.github/workflows/build-msvc.yml +++ b/.github/workflows/build-msvc.yml @@ -55,7 +55,7 @@ jobs: - name: Upload Release Artifacts if: matrix.configuration == 'Release' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: C3-Release path: Build/** From 3708d25a8c355c966162b51179880e873ef0b7bd Mon Sep 17 00:00:00 2001 From: Meatballs1 Date: Tue, 23 Sep 2025 20:23:44 +0100 Subject: [PATCH 4/8] Fix artifact output --- .github/workflows/build-msvc.yml | 20 +++++++++++++++++--- README.md | 4 ++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-msvc.yml b/.github/workflows/build-msvc.yml index 0ccd2a3f..43cc1df4 100644 --- a/.github/workflows/build-msvc.yml +++ b/.github/workflows/build-msvc.yml @@ -3,6 +3,7 @@ name: Build C3 (MSVC) on: push: branches: [ master ] + tags: ['v*.*.*'] pull_request: branches: [ master ] @@ -45,19 +46,32 @@ jobs: run: | mkdir Build mkdir Build\Bin - mkdir Build\Bin\WebController copy StartWebController.cmd Build\StartWebController.cmd copy RestartWebController.cmd Build\RestartWebController.cmd copy Res\GatewayConfiguration.json Build\Bin\GatewayConfiguration.json - xcopy /E /I /Y Bin\WebController Build\Bin\WebController + xcopy /E /I /Y Bin\WebController Build\WebController + rmdir Bin\WebController xcopy /E /I /Y Bin Build\Bin + Get-ChildItem -Path Build\Bin -Include *.exp,*.lib,*.map -Recurse | Remove-Item -Force + + - name: Set artifact name + id: artifact_name + run: | + if [ "${{ github.event_name }}" = "pull_request" ]; then + echo "name=C3-pr-${{ github.event.pull_request.number }}-${{ github.sha }}" >> $GITHUB_OUTPUT + elif [ "${{ github.ref_type }}" = "tag" ]; then + echo "name=C3-${{ github.ref_name }}-Release" >> $GITHUB_OUTPUT + else + echo "name=C3-${{ github.run_number }}-Release" >> $GITHUB_OUTPUT + fi + shell: bash - name: Upload Release Artifacts if: matrix.configuration == 'Release' uses: actions/upload-artifact@v4 with: - name: C3-Release + name: ${{ steps.artifact_name.outputs.name }} path: Build/** diff --git a/README.md b/README.md index b2a95d5a..6f2c1d4b 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ ![C3](Res/Images/C3.png) -![Build C3 (MSVC)](https://github.com/ReversecLabs/C3/workflows/Build%20C3%20(MSVC)/badge.svg) +![Build C3 (MSVC)](https://github.com/ReversecLabs/C3/workflows/Build%20C3%20(MSVC)/badge.svg?branch=master) -![Build C3 (Clang)](https://github.com/ReversecLabs/C3/workflows/Build%20C3%20(Clang)/badge.svg) +![Build C3 (Clang)](https://github.com/ReversecLabs/C3/workflows/Build%20C3%20(Clang)/badge.svg?branch=master) C3 (Custom Command and Control) is a tool that allows Red Teams to rapidly develop and utilise esoteric command and control channels (C2). It's a framework that extends other red team tooling, such as the commercial Cobalt Strike (CS) product via [ExternalC2](https://hstechdocs.helpsystems.com/manuals/cobaltstrike/current/userguide/content/externalc2spec.pdf), which is supported at release. It allows the Red Team to concern themselves only with the C2 they want to implement; relying on the robustness of C3 and the CS tooling to take care of the rest. This efficiency and reliability enable Red Teams to operate safely in critical client environments (by assuring a professional level of stability and security); whilst allowing for safe experimentation and rapid deployment of customised Tactics, Techniques and Procedures (TTPs). Thus, empowering Red Teams to emulate and simulate an adaptive real-world attacker. From 061ade522245a5fa0a53fc0f532ed87dfc23fba5 Mon Sep 17 00:00:00 2001 From: Meatballs1 Date: Tue, 23 Sep 2025 20:38:41 +0100 Subject: [PATCH 5/8] Fix artifact output --- .github/workflows/build-msvc.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-msvc.yml b/.github/workflows/build-msvc.yml index 43cc1df4..b9f7351e 100644 --- a/.github/workflows/build-msvc.yml +++ b/.github/workflows/build-msvc.yml @@ -50,9 +50,8 @@ jobs: copy StartWebController.cmd Build\StartWebController.cmd copy RestartWebController.cmd Build\RestartWebController.cmd copy Res\GatewayConfiguration.json Build\Bin\GatewayConfiguration.json - xcopy /E /I /Y Bin\WebController Build\WebController - rmdir Bin\WebController - xcopy /E /I /Y Bin Build\Bin + Move-Item Bin\WebController Build\WebController + Move-Item Bin Build\Bin Get-ChildItem -Path Build\Bin -Include *.exp,*.lib,*.map -Recurse | Remove-Item -Force - name: Set artifact name From a2d438ef74b5f20e5df4f03419df0806ad541636 Mon Sep 17 00:00:00 2001 From: Meatballs1 Date: Tue, 23 Sep 2025 20:57:17 +0100 Subject: [PATCH 6/8] Add release workflow --- .github/workflows/build-clang.yml | 7 ++-- .github/workflows/build-msvc.yml | 63 ++++++++++++++---------------- .github/workflows/release-msvc.yml | 62 +++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/release-msvc.yml diff --git a/.github/workflows/build-clang.yml b/.github/workflows/build-clang.yml index 8a356f8e..06ec03f4 100644 --- a/.github/workflows/build-clang.yml +++ b/.github/workflows/build-clang.yml @@ -3,15 +3,16 @@ name: Build C3 (Clang) on: push: branches: [ master ] -# pull_request: -# branches: [ master ] + pull_request: + branches: [ master ] jobs: build: name: Build C3 (Clang) strategy: matrix: - configuration: [ClangDebug, ClangRwdi, ClangRelease] + configuration: [ClangRelease] +# configuration: [ClangDebug, ClangRwdi, ClangRelease] runs-on: windows-2022 steps: diff --git a/.github/workflows/build-msvc.yml b/.github/workflows/build-msvc.yml index b9f7351e..221b2c0e 100644 --- a/.github/workflows/build-msvc.yml +++ b/.github/workflows/build-msvc.yml @@ -41,37 +41,32 @@ jobs: - name: Build WebService run: dotnet publish -p:Platform=any -c ${{ matrix.configuration }} Src/WebController/Backend -o Bin/WebController - - - name: Prepare Build Output Structure - run: | - mkdir Build - mkdir Build\Bin - - copy StartWebController.cmd Build\StartWebController.cmd - copy RestartWebController.cmd Build\RestartWebController.cmd - copy Res\GatewayConfiguration.json Build\Bin\GatewayConfiguration.json - Move-Item Bin\WebController Build\WebController - Move-Item Bin Build\Bin - Get-ChildItem -Path Build\Bin -Include *.exp,*.lib,*.map -Recurse | Remove-Item -Force - - - name: Set artifact name - id: artifact_name - run: | - if [ "${{ github.event_name }}" = "pull_request" ]; then - echo "name=C3-pr-${{ github.event.pull_request.number }}-${{ github.sha }}" >> $GITHUB_OUTPUT - elif [ "${{ github.ref_type }}" = "tag" ]; then - echo "name=C3-${{ github.ref_name }}-Release" >> $GITHUB_OUTPUT - else - echo "name=C3-${{ github.run_number }}-Release" >> $GITHUB_OUTPUT - fi - shell: bash - - - name: Upload Release Artifacts - if: matrix.configuration == 'Release' - uses: actions/upload-artifact@v4 - with: - name: ${{ steps.artifact_name.outputs.name }} - path: Build/** - - - +# - name: Prepare Build Output Structure +# run: | +# mkdir Build +# +# copy StartWebController.cmd Build\StartWebController.cmd +# copy RestartWebController.cmd Build\RestartWebController.cmd +# copy Res\GatewayConfiguration.json Build\Bin\GatewayConfiguration.json +# Move-Item Bin\WebController Build\WebController +# Move-Item Bin Build\Bin +# Get-ChildItem -Path Build\Bin -Include *.exp,*.lib,*.map -Recurse | Remove-Item -Force +# +# - name: Set artifact name +# id: artifact_name +# run: | +# if [ "${{ github.event_name }}" = "pull_request" ]; then +# echo "name=C3-pr-${{ github.event.pull_request.number }}-${{ github.sha }}" >> $GITHUB_OUTPUT +# elif [ "${{ github.ref_type }}" = "tag" ]; then +# echo "name=C3-${{ github.ref_name }}-Release" >> $GITHUB_OUTPUT +# else +# echo "name=C3-${{ github.run_number }}-Release" >> $GITHUB_OUTPUT +# fi +# shell: bash +# +# - name: Upload Release Artifacts +# if: matrix.configuration == 'Release' +# uses: actions/upload-artifact@v4 +# with: +# name: ${{ steps.artifact_name.outputs.name }} +# path: Build/** diff --git a/.github/workflows/release-msvc.yml b/.github/workflows/release-msvc.yml new file mode 100644 index 00000000..c68c464a --- /dev/null +++ b/.github/workflows/release-msvc.yml @@ -0,0 +1,62 @@ +name: Build C3 (MSVC) + +on: + release: + types: [published] + +jobs: + build: + name: Build C3 (MSVC) + runs-on: windows-2022 + steps: + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v2 + + - name: Setup .NET Core 3.1 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '3.1.x' + + - name: Checkout + uses: actions/checkout@v2 + + - name: Dotnet restore + run: msbuild Src/C3.sln "/t:restore" + + - name: Build MSVC x86 + run: msbuild Src/C3.sln /p:Platform=x86 /p:Configuration=Release "/t:GatewayConsoleExe;NodeRelayConsoleExe;NodeRelayDll;CebuLoader;ChannelLinter" + + - name: Build MSVC x64 + run: msbuild Src/C3.sln /p:Platform=x64 /p:Configuration=Release "/t:GatewayConsoleExe;NodeRelayConsoleExe;NodeRelayDll;CebuLoader;ChannelLinter" + + - name: Build WebService + run: dotnet publish -p:Platform=any -c Release Src/WebController/Backend -o Bin/WebController + + - name: Prepare Build Output Structure + run: | + mkdir Build + + copy StartWebController.cmd Build\StartWebController.cmd + copy RestartWebController.cmd Build\RestartWebController.cmd + copy Res\GatewayConfiguration.json Build\Bin\GatewayConfiguration.json + + Move-Item Bin\WebController Build\WebController + Move-Item Bin Build\Bin + Get-ChildItem -Path Build\Bin -Include *.exp,*.lib,*.map -Recurse | Remove-Item -Force + + + - name: Build and Zip Artifact + run: | + powershell Compress-Archive -Path Build\* -DestinationPath C3-${{ github.event.release.tag_name }}-Release.zip + + + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: C3-${{ github.event.release.tag_name }}-Release.zip + asset_name: C3-${{ github.event.release.tag_name }}-Release.zip + asset_content_type: application/zip + From 6e6b57b766889d6189610f7d6825a759c781a89c Mon Sep 17 00:00:00 2001 From: Meatballs1 Date: Tue, 23 Sep 2025 21:21:09 +0100 Subject: [PATCH 7/8] Fix release workflow --- .github/workflows/build-msvc.yml | 1 - .github/workflows/release-msvc.yml | 13 ++++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-msvc.yml b/.github/workflows/build-msvc.yml index 221b2c0e..4e53f87e 100644 --- a/.github/workflows/build-msvc.yml +++ b/.github/workflows/build-msvc.yml @@ -3,7 +3,6 @@ name: Build C3 (MSVC) on: push: branches: [ master ] - tags: ['v*.*.*'] pull_request: branches: [ master ] diff --git a/.github/workflows/release-msvc.yml b/.github/workflows/release-msvc.yml index c68c464a..c3d27be5 100644 --- a/.github/workflows/release-msvc.yml +++ b/.github/workflows/release-msvc.yml @@ -1,12 +1,10 @@ -name: Build C3 (MSVC) - on: release: types: [published] jobs: build: - name: Build C3 (MSVC) + name: Build C3 Release Artifact (MSVC) runs-on: windows-2022 steps: - name: Add msbuild to PATH @@ -44,12 +42,10 @@ jobs: Move-Item Bin Build\Bin Get-ChildItem -Path Build\Bin -Include *.exp,*.lib,*.map -Recurse | Remove-Item -Force + - name: Build and Zip Artifact + run: | + powershell Compress-Archive -Path Build\* -DestinationPath C3-${{ github.event.release.tag_name }}-Release.zip - - name: Build and Zip Artifact - run: | - powershell Compress-Archive -Path Build\* -DestinationPath C3-${{ github.event.release.tag_name }}-Release.zip - - - name: Upload Release Asset uses: actions/upload-release-asset@v1 env: @@ -59,4 +55,3 @@ jobs: asset_path: C3-${{ github.event.release.tag_name }}-Release.zip asset_name: C3-${{ github.event.release.tag_name }}-Release.zip asset_content_type: application/zip - From bd9833c3a5c0edafd76fdb80f1b7bab5514b52a1 Mon Sep 17 00:00:00 2001 From: Meatballs1 Date: Tue, 23 Sep 2025 21:25:28 +0100 Subject: [PATCH 8/8] Update release --- .github/workflows/release-msvc.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release-msvc.yml b/.github/workflows/release-msvc.yml index c3d27be5..cac05050 100644 --- a/.github/workflows/release-msvc.yml +++ b/.github/workflows/release-msvc.yml @@ -1,3 +1,5 @@ +name: Build C3 Release Artifact (MSVC) + on: release: types: [published]