@@ -11,32 +11,36 @@ CLI tool that can replace C# methods in .NET Core applications
11
11
12
12
### Requirements
13
13
14
- - Visual Studio 2022 with installed C++ & C# build tools: https://visualstudio.microsoft.com/en/vs/
14
+ - C++ & C#
15
+ - Linux: g++, .NET 8: https://dotnet.microsoft.com/en-us/download/dotnet/8.0
16
+ - Windows: Visual Studio 2022 with installed C++ & C# build tools: https://visualstudio.microsoft.com/en/vs/
15
17
- Node.js: https://nodejs.org/en/download/
16
18
- frida: https://frida.re
17
19
18
- ### Installation on Windows
20
+ ### Building
19
21
20
22
Open command line and run this script
21
23
24
+ - ` _build.sh ` on Linux
25
+ - ` _build.bat ` on Windows
26
+
22
27
It will build
23
28
24
29
- Node.js package [ net-core-injector] ( package.json ) - DLL-injector written in TypeScript
25
30
- [ Bootstrapper] ( Bootstrapper ) - helper native library written in C++ to interact with .NET Core runtime
26
31
- [ DemoApplication] ( DemoApplication ) - test application to demonstrate how it works
27
32
- [ RuntimePatcher] ( RuntimePatcher ) - code that attaches to [ DemoApplication] ( DemoApplication )
28
33
29
- ```
30
- _build.bat
31
- ```
32
-
33
34
### Running
34
35
35
36
This script should produce output like the GIF above
36
37
37
- ```
38
- _run.bat
39
- ```
38
+ - ` _run.sh ` on Linux
39
+
40
+ Note: If you want to attach to an existing process on Linux, this requires root privileges. In this case, use
41
+ ` _run.sh -a ` (attach).
42
+
43
+ - ` _run.bat ` on Windows
40
44
41
45
### Internal documentation
42
46
@@ -50,8 +54,8 @@ I did it in [`Bootstrapper/src/library.cpp`](Bootstrapper/src/library.cpp).
50
54
51
55
[ ` net-core-injector/src/main.ts ` ] ( src/main.ts ) injects ` Bootstrapper.dll ` into C# process and loads custom assembly
52
56
53
-
54
57
The following command runs ` DemoApplication.exe ` on another thread and injects code.
58
+
55
59
```
56
60
start DemoApplication\dist\DemoApplication.exe
57
61
@@ -64,6 +68,7 @@ RuntimePatcher\dist\RuntimePatcher.dll ^
64
68
```
65
69
66
70
Then the execution happens in this order:
71
+
67
72
1 . get into ` DemoApplication.exe ` process memory via DLL-injection of ` Bootstrapper.dll `
68
73
2 . call native C++ code
69
74
``` cpp
@@ -86,4 +91,4 @@ You can use this to mod games written in C# or to patch any software
86
91
87
92
### TODO
88
93
89
- - Linux support is incomplete due to some issues with the secondary host context in `hostfxr`
94
+ - I don't have macOS device so it's supported for now. External contributors are welcome.
0 commit comments