Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 52 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,27 @@ on:
- main

jobs:
build:
build-debug:
name: Build Debug
runs-on: [self-hosted, DESKTOP-N792BI5]

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgJsonGlob: 'vcpkg.json'
buildPreset: debug

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2

- name: Configure CMake (Debug)
run: cmake --preset debug -G "Visual Studio 17 2022" -DBUILD_DOC=OFF -DBUILD_DRIVER=ON -DBUILD_WIX_INSTALLER=OFF -DBUILD_GRPC=ON
run: cmake --preset debug -DBUILD_DOC=OFF -DBUILD_DRIVER=ON -DBUILD_WIX_INSTALLER=OFF -DBUILD_GRPC=ON -G "Visual Studio 17 2022"
env:
VCPKG_ROOT: ${{ github.workspace }}/vcpkg

Expand All @@ -37,7 +41,49 @@ jobs:
with:
name: panoptes-debug
path: |
build/debug/**/*.dll
build/debug/**/*.exe
build/debug/**/*.pdb
bin/Debug/**/*.dll
bin/Debug/**/*.exe
bin/Debug/**/*.pdb
bin/tests/Debug/**/*.exe
bin/tests/Debug/**/*.pdb
if-no-files-found: warn

build-release:
name: Build Release
runs-on: [self-hosted, DESKTOP-N792BI5]

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgJsonGlob: 'vcpkg.json'
buildPreset: release

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2

- name: Configure CMake (Release)
run: cmake --preset release -DBUILD_DOC=OFF -DBUILD_DRIVER=ON -DBUILD_WIX_INSTALLER=OFF -DBUILD_GRPC=ON -G "Visual Studio 17 2022"
env:
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
CMAKE_GENERATOR: "Visual Studio 17 2022"

- name: Build (Release)
run: msbuild build/release/Panoptes.sln /p:Configuration=Release /p:Platform=x64 /m

- name: Upload Release Artifacts
uses: actions/upload-artifact@v4
with:
name: panoptes-release
path: |
bin/Release/**/*.dll
bin/Release/**/*.exe
bin/Release/**/*.pdb
bin/tests/Release/**/*.exe
bin/tests/Release/**/*.pdb
if-no-files-found: warn
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "src/dll/Detours"]
path = src/dll/Detours
url = https://github.com/microsoft/detours.git
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ if(BUILD_DRIVER)
endif()

if(BUILD_WIX_INSTALLER)
add_subdirectory(src/driver)
add_subdirectory(installer/Setup)
add_subdirectory(installer/Wix)
endif()
5 changes: 5 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"gRPC_DIR": "vcpkg_installed/x64-windows-static/share/grpc",
"nlohmann_json_DIR": "vcpkg_installed/x64-windows-static/share/nlohmann_json",
"CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreadedDebug",
"VCPKG_APPLOCAL_DEPS": "OFF",
"PRESET_NAME": "Debug",
"x86_BUILD_TOOLS_PATH": "C:/Program Files (x86)/Windows Kits/10/bin/10.0.26100.0/x86/",
"x64_BUILD_TOOLS_PATH": "C:/Program Files (x86)/Windows Kits/10/bin/10.0.26100.0/x64"
}
Expand All @@ -34,6 +36,9 @@
"Protobuf_PROTOC_EXECUTABLE": "vcpkg_installed/x64-windows-static/tools/protobuf/protoc.exe",
"gRPC_DIR": "vcpkg_installed/x64-windows-static/share/grpc",
"nlohmann_json_DIR": "vcpkg_installed/x64-windows-static/share/nlohmann_json",
"CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded",
"VCPKG_APPLOCAL_DEPS": "OFF",
"PRESET_NAME": "Release",
"x86_BUILD_TOOLS_PATH": "C:/Program Files (x86)/Windows Kits/10/bin/10.0.26100.0/x86/",
"x64_BUILD_TOOLS_PATH": "C:/Program Files (x86)/Windows Kits/10/bin/10.0.26100.0/x64"
}
Expand Down
21 changes: 0 additions & 21 deletions CppProperties.json

This file was deleted.

113 changes: 105 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,22 +145,119 @@ For kernel development environment setup, see:
- [Ap3x/Windows-Kernel-Development-Infrastructure](https://github.com/Ap3x/Windows-Kernel-Development-Infrastructure)
- [Microsoft WDK Installation Guide](https://learn.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk)

### CMake Build Options
### Building Panoptes

#### Prerequisites

Ensure you have the following installed:
- Visual Studio 2022 with C++ workload
- Windows Driver Kit (WDK)
- Vcpkg (with `VCPKG_ROOT` environment variable set)
- CMake 3.15 or higher

#### CMake Build Options

The following CMake options are available during configuration:

- `BUILD_DOC` (OFF by default): Build Doxygen documentation
- `BUILD_WIX_INSTALLER` (OFF by default): Build the Wix MSI installer package
- `BUILD_DRIVER` (OFF by default): Build the kernel driver package
- `BUILD_GRPC` (OFF by default): Generate gRPC code from protobuf definitions
- `BUILD_GRPC` (ON by default): Generate gRPC code from protobuf definitions

#### Building with CMake Presets (Recommended)

##### Debug Build

```powershell
# Configure for Debug
cmake --preset debug -DBUILD_GRPC=ON

# Build using CMake
cmake --build build/debug --config Debug

# Or build using MSBuild directly
msbuild build/debug/Panoptes.sln /p:Configuration=Debug /p:Platform=x64 /m
```

Output: `./bin/Debug/`

##### Release Build

```powershell
# Configure for Release
cmake --preset release -DBUILD_GRPC=ON

# Build using CMake
cmake --build build/release --config Release

# Or build using MSBuild directly
msbuild build/release/Panoptes.sln /p:Configuration=Release /p:Platform=x64 /m
```

Output: `./bin/Release/`

#### Building Specific Projects

To build only the main service:

**Debug:**
```powershell
msbuild build/debug/src/service/PanoptesService.vcxproj /p:Configuration=Debug /p:Platform=x64
```

**Release:**
```powershell
msbuild build/release/src/service/PanoptesService.vcxproj /p:Configuration=Release /p:Platform=x64
```

#### Building with Additional Options

Enable all optional components:

```powershell
# Debug with all options
cmake --preset debug -DBUILD_GRPC=ON -DBUILD_DRIVER=ON -DBUILD_WIX_INSTALLER=ON -DBUILD_DOC=ON
cmake --build build/debug --config Debug

# Release with all options
cmake --preset release -DBUILD_GRPC=ON -DBUILD_DRIVER=ON -DBUILD_WIX_INSTALLER=ON -DBUILD_DOC=ON
cmake --build build/release --config Release
```

#### Clean Build

```powershell
# Remove previous build artifacts
Remove-Item -Recurse -Force build/debug
Remove-Item -Recurse -Force build/release

# Then configure and build as usual
cmake --preset debug -DBUILD_GRPC=ON
cmake --build build/debug --config Debug
```

#### Build Outputs

| Configuration | Location | Executable | PDB |
|---|---|---|---|
| Debug | `./bin/Debug/` | PanoptesService.exe (71 MB) | PanoptesService.pdb |
| Release | `./bin/Release/` | PanoptesService.exe | (embedded or separate) |

#### MSBuild Command Reference

Common MSBuild parameters:

- `/p:Configuration=<Config>` - Build configuration (Debug, Release)
- `/p:Platform=x64` - Platform architecture (x64, Win32)
- `/m` - Build in parallel using all available cores
- `/v:n` - Verbosity (q=quiet, m=minimal, n=normal, d=detailed)
- `/t:Rebuild` - Clean and rebuild (instead of incremental)
- `/t:Clean` - Clean build artifacts only

Example with verbose output and parallel build:

Example CMake configuration:
```powershell
mkdir build
cd build
cmake --preset debug -DBUILD_DOC=ON -DBUILD_DRIVER=ON -DBUILD_WIX_INSTALLER=ON ..
cd debug
msbuild /p:Configuration=Debug Panoptes.sln
msbuild build/debug/Panoptes.sln /p:Configuration=Debug /p:Platform=x64 /m /v:normal
```

## Screenshots of Panoptes Features
Expand Down
2 changes: 1 addition & 1 deletion installer/Setup/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ endif()
target_include_directories(PanoptesSetup PRIVATE ${CATCH_INCLUDE_DIR})

set_target_properties(${PROJECT_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/${PRESET_NAME}"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/$<CONFIG>"
)

# Configure specific settings for different configurations
Expand Down
3 changes: 1 addition & 2 deletions installer/Wix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ add_custom_command(
-bindpath "${CMAKE_SOURCE_DIR}/assets/yara"
-bindpath "${CMAKE_SOURCE_DIR}/assets"
-bindpath "${CMAKE_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}"
-bindpath "${CMAKE_SOURCE_DIR}/bin/driver/${CMAKE_BUILD_TYPE}"
-bindpath "${CMAKE_SOURCE_DIR}/bin/driver"
-bindpath "${CMAKE_SOURCE_DIR}/bin/Release/driver"
-bindpath "${CMAKE_SOURCE_DIR}/assets/icons"
-bindpath "${CMAKE_CURRENT_SOURCE_DIR}/assets"
${WIX_SOURCES}
Expand Down
2 changes: 1 addition & 1 deletion installer/Wix/WixInstaller.wixproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</PropertyGroup>
<ItemGroup>
<BindPath Include="$(SolutionDir)assets\yara" />
<BindPath Include="$(SolutionDir)bin\bin\x64\Release\driver\PanoptesDriver" />
<BindPath Include="$(SolutionDir)bin\Release\driver" />
<BindPath Include="$(SolutionDir)src\libraries\TrayNotificationsCore\assets" />
<BindPath Include="$(SolutionDir)bin\x64\Release" />
<BindPath Include="$(SolutionDir)bin\Win32\Release" />
Expand Down
79 changes: 50 additions & 29 deletions src/container/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,45 +28,66 @@ set(HEADERS
add_executable(${PROJECT_NAME} WIN32 ${SOURCES} ${HEADERS})

if(BUILD_GRPC)
find_package(Protobuf CONFIG REQUIRED)
find_package(gRPC CONFIG REQUIRED)

# Set proto file path
set(PROTO_FILE_DIR "${CMAKE_SOURCE_DIR}/proto/src/")
set(PROTO_BUILD_DIR "${CMAKE_SOURCE_DIR}/proto/build")
set(PROTO_SRC "${CMAKE_SOURCE_DIR}/proto/src")
set(PROTO_FILE "${PROTO_SRC}/panoptes.proto")
set(PROTO_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}")

# Create build directory if it doesn't exist
file(MAKE_DIRECTORY ${PROTO_BUILD_DIR})
# Generated file paths
set(PROTO_PB_CC "${PROTO_OUT_DIR}/panoptes.pb.cc")
set(PROTO_PB_H "${PROTO_OUT_DIR}/panoptes.pb.h")
set(PROTO_GRPC_CC "${PROTO_OUT_DIR}/panoptes.grpc.pb.cc")
set(PROTO_GRPC_H "${PROTO_OUT_DIR}/panoptes.grpc.pb.h")

# Find protoc executable
find_program(PROTOC_EXECUTABLE protoc REQUIRED)

message(" --> PROTOBUF LIB: ${PROTOBUF_LIBRARIES}")
message(" --> PROTOBUF INCLUDE: ${Protobuf_INCLUDE_DIRS}")
message(" --> PROTOBUF VERSION: ${Protobuf_VERSION}")
message(" --> PROTOBUF Found: ${Protobuf_FOUND}")
message(" --> PROTOBUF SRC: ${PROTO_SRC}")
message(" --> PROTOBUF HEADER: ${PROTO_HEADER}")
message(" --> PROTOBUF Folder: ${CMAKE_BINARY_DIR}/proto")

#target_link_libraries(${PROJECT_NAME} PUBLIC protobuf::libprotobuf gRPC::grpc++)

set(PROTO_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated")

target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${PROTO_BINARY_DIR}>")

protobuf_generate(
TARGET ${PROJECT_NAME}
IMPORT_DIRS ${PROTO_FILE_DIR}
PROTOC_EXE "${CMAKE_BINARY_DIR}/${Protobuf_PROTOC_EXECUTABLE}"
PROTOC_OUT_DIR "${PROTO_BINARY_DIR}"
message(" --> PROTO_FILE: ${PROTO_FILE}")
message(" --> Protobuf Compiler: ${PROTOC_EXECUTABLE}")

# Create custom command for protobuf generation
add_custom_command(
OUTPUT ${PROTO_PB_CC} ${PROTO_PB_H}
COMMAND ${PROTOC_EXECUTABLE}
ARGS --cpp_out=${PROTO_OUT_DIR}
-I${PROTO_SRC}
${PROTO_FILE}
DEPENDS ${PROTO_FILE}
COMMENT "Running protobuf compiler on ${PROTO_FILE}"
VERBATIM
)

# Create custom command for gRPC generation
add_custom_command(
OUTPUT ${PROTO_GRPC_CC} ${PROTO_GRPC_H}
COMMAND ${PROTOC_EXECUTABLE}
ARGS --grpc_out=${PROTO_OUT_DIR}
--plugin=protoc-gen-grpc=$<TARGET_FILE:gRPC::grpc_cpp_plugin>
-I${PROTO_SRC}
${PROTO_FILE}
DEPENDS ${PROTO_FILE} ${PROTO_PB_CC} gRPC::grpc_cpp_plugin
COMMENT "Running gRPC compiler on ${PROTO_FILE}"
VERBATIM
)

protobuf_generate(
TARGET ${PROJECT_NAME}
LANGUAGE grpc
PROTOC_EXE "${CMAKE_BINARY_DIR}/${Protobuf_PROTOC_EXECUTABLE}"
GENERATE_EXTENSIONS .grpc.pb.h .grpc.pb.cc
PLUGIN "protoc-gen-grpc=\$<TARGET_FILE:gRPC::grpc_cpp_plugin>"
IMPORT_DIRS ${PROTO_FILE_DIR}
PROTOC_OUT_DIR "${PROTO_BINARY_DIR}"

# Add generated files as source to the target
target_sources(${PROJECT_NAME} PRIVATE
${PROTO_PB_CC}
${PROTO_GRPC_CC}
)

# Add include directory for generated files
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${PROTO_OUT_DIR}>")

# Link protobuf and gRPC libraries
target_link_libraries(${PROJECT_NAME} PRIVATE protobuf::libprotobuf)
endif()

# Include directories
Expand All @@ -91,7 +112,7 @@ endif()

# Set output directories to match Visual Studio structure
set_target_properties(${PROJECT_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/${PRESET_NAME}"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/$<CONFIG>"
)

# Set static runtime for MSVC
Expand Down
Loading
Loading