Skip to content

Commit 8c84534

Browse files
committed
Initial commit
0 parents  commit 8c84534

File tree

12 files changed

+204
-0
lines changed

12 files changed

+204
-0
lines changed

.github/workflows/build.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Build & Test
2+
on:
3+
push:
4+
branches: [ main ]
5+
pull_request:
6+
branches: [ main ]
7+
jobs:
8+
build:
9+
runs-on: windows-2022
10+
steps:
11+
- uses: actions/checkout@v4
12+
- run: vcpkg install detours:x64-windows gtest:x64-windows
13+
- run: cmake --preset=ci-windows
14+
- run: cmake --build --preset=ci-windows --config Release
15+
- run: ctest --preset=ci-windows -C Release --output-on-failure

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
cmake_minimum_required(VERSION 3.25)
2+
project(Chain_of_Trust)

CMakePresets.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"version": 6,
3+
"configurePresets": [
4+
{
5+
"name": "ci-windows",
6+
"generator": "Visual Studio 17 2022",
7+
"binaryDir": "${sourceDir}/out/build/${presetName}",
8+
"architecture": "x64",
9+
"cacheVariables": {
10+
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
11+
}
12+
}
13+
]
14+
}

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Chain_of_Trust
2+
Open-source, kernel-backed, TPM-sealed EDR.

generate_repo.py

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
import subprocess
2+
from pathlib import Path
3+
4+
BASE = Path.cwd()
5+
6+
def create_dirs():
7+
folders = [
8+
".github/workflows", "src/edr_agent", "src/edr_kernel",
9+
"src/common", "cmake", "scripts", "policies"
10+
]
11+
for folder in folders:
12+
Path(BASE / folder).mkdir(parents=True, exist_ok=True)
13+
14+
def write(path, content):
15+
Path(BASE / path).write_text(content.strip() + "\n", encoding="utf-8")
16+
17+
def git_init():
18+
subprocess.run(["git", "init"], check=True)
19+
subprocess.run(["git", "add", "."], check=True)
20+
subprocess.run(["git", "commit", "-m", "Initial commit"], check=True)
21+
22+
def main():
23+
create_dirs()
24+
25+
write("README.md", "# Chain_of_Trust\nOpen-source, kernel-backed, TPM-sealed EDR.")
26+
write("CMakeLists.txt", "cmake_minimum_required(VERSION 3.25)\nproject(Chain_of_Trust)")
27+
write("CMakePresets.json", """{
28+
"version": 6,
29+
"configurePresets": [
30+
{
31+
"name": "ci-windows",
32+
"generator": "Visual Studio 17 2022",
33+
"binaryDir": "${sourceDir}/out/build/${presetName}",
34+
"architecture": "x64",
35+
"cacheVariables": {
36+
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
37+
}
38+
}
39+
]
40+
}""")
41+
42+
write("vcpkg.json", """{
43+
"name": "chain-of-trust",
44+
"version": "1.0.0",
45+
"dependencies": [
46+
"detours",
47+
"gtest"
48+
]
49+
}""")
50+
51+
write(".github/workflows/build.yml", """name: Build & Test
52+
on:
53+
push:
54+
branches: [ main ]
55+
pull_request:
56+
branches: [ main ]
57+
jobs:
58+
build:
59+
runs-on: windows-2022
60+
steps:
61+
- uses: actions/checkout@v4
62+
- run: vcpkg install detours:x64-windows gtest:x64-windows
63+
- run: cmake --preset=ci-windows
64+
- run: cmake --build --preset=ci-windows --config Release
65+
- run: ctest --preset=ci-windows -C Release --output-on-failure
66+
""")
67+
68+
write("src/edr_agent/main.cpp", """#include <windows.h>
69+
int main() {
70+
return 0;
71+
}
72+
""")
73+
74+
write("src/edr_kernel/edrdrv.c", """#include <ntddk.h>
75+
NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) {
76+
UNREFERENCED_PARAMETER(DriverObject);
77+
UNREFERENCED_PARAMETER(RegistryPath);
78+
return STATUS_SUCCESS;
79+
}
80+
""")
81+
82+
write("src/edr_kernel/edrdrv.inf", """[Version]
83+
Signature="$WINDOWS NT$"
84+
Class=Sample
85+
ClassGuid={78A1C341-4539-11d3-B88D-00C04FAD5171}
86+
Provider=%ManufacturerName%
87+
DriverVer=09/20/2025,1.0.0.0
88+
89+
[Manufacturer]
90+
%ManufacturerName%=Standard,NTx86,NTamd64
91+
92+
[Standard.NTx86]
93+
%DeviceName%=Install, Root\\EDRDriver
94+
95+
[Standard.NTamd64]
96+
%DeviceName%=Install, Root\\EDRDriver
97+
98+
[Strings]
99+
ManufacturerName="Chain_of_Trust"
100+
DeviceName="EDR Kernel Driver"
101+
""")
102+
103+
write("scripts/Build.ps1", """cmake --preset=ci-windows
104+
cmake --build --preset=ci-windows --config Release
105+
""")
106+
107+
write("scripts/Install.ps1", """Write-Host "Installing EDR driver..."
108+
pnputil /add-driver src\\edr_kernel\\edrdrv.inf /install
109+
""")
110+
111+
write("policies/WDAC_EDR.xml", """<SiPolicy xmlns="urn:schemas-microsoft-com:sipolicy">
112+
<PolicyName>Chain_of_Trust_EDR</PolicyName>
113+
<Rules>
114+
<!-- Add WDAC rules here -->
115+
</Rules>
116+
</SiPolicy>
117+
""")
118+
119+
git_init()
120+
print("[+] Chain_of_Trust Repo erfolgreich generiert und initialisiert.")
121+
122+
if __name__ == "__main__":
123+
main()
124+

policies/WDAC_EDR.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<SiPolicy xmlns="urn:schemas-microsoft-com:sipolicy">
2+
<PolicyName>Chain_of_Trust_EDR</PolicyName>
3+
<Rules>
4+
<!-- Add WDAC rules here -->
5+
</Rules>
6+
</SiPolicy>

scripts/Build.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
cmake --preset=ci-windows
2+
cmake --build --preset=ci-windows --config Release

scripts/Install.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Write-Host "Installing EDR driver..."
2+
pnputil /add-driver src\edr_kernel\edrdrv.inf /install

src/edr_agent/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#include <windows.h>
2+
int main() {
3+
return 0;
4+
}

src/edr_kernel/edrdrv.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include <ntddk.h>
2+
NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) {
3+
UNREFERENCED_PARAMETER(DriverObject);
4+
UNREFERENCED_PARAMETER(RegistryPath);
5+
return STATUS_SUCCESS;
6+
}

0 commit comments

Comments
 (0)