You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> There are multiple ways to install the pyCTools library!
11
-
>
12
-
> ***Manual installation:**
13
-
>
14
-
> 1. Clone the repository and build the DLLs yourself.
15
-
> 2. Run `python ./tools/setup.py bdist_wheel` to create the wheel file.
16
-
> 3. The setup script will show you how to install the package locally with pip and how to create a virtual environment for testing.
17
-
> ***Automatic installation:**
18
-
> Go to the [releases page](https://github.com/DefinetlyNotAI/PyCTools/releases) and select the version you wish to install, and click on it, then copy the top `pip` command that will allow you to install it
19
-
> [Auto installation support from v0.2.0-beta and above]
20
-
1
+
# Project Overview
21
2
22
3
This project provides a cross-language toolkit for Windows process inspection and hardware random number generation, with both Python and C components. It includes:
23
4
@@ -26,101 +7,56 @@ This project provides a cross-language toolkit for Windows process inspection an
26
7
-**Example Python scripts**: Demonstrate usage of the library.
27
8
-**PowerShell build helper**: Automates DLL compilation for x86/x64.
28
9
29
-
> [!IMPORTANT]
30
-
> To get the `dist` binary folder, choose **one** of the following options:
> | Manual Build | Compile the binaries yourself using `cl.exe` or similar toolchains | Microsoft Visual Studio with MSVC installed |
35
-
> | Auto Build Script | Run the [`tool/compilerHelper.ps1`](tool/compilerHelper.ps1) PowerShell script | Visual Studio Build Tools + PowerShell |
36
-
> | Prebuilt Release Archive | Download precompiled binaries from the [releases page](https://github.com/DefinetlyNotAI/PyCTools/releases/)| None, make sure to use the latest available version |
37
-
>
38
-
> No matter what you decide, do still read the important notice about the `dist` from the [release](https://github.com/DefinetlyNotAI/PyCTools/releases/) OR check the [Wiki](https://github.com/DefinetlyNotAI/PyCTools/wiki#dll-discovery-and-dist-directory) page about the DLL discovery explanation.
39
-
40
10
## Directory Structure
41
11
42
-
<details>
43
-
<summary>📁 Project Structure (click to expand)</summary>
processInspect.py # Python wrapper for process inspection DLL
17
+
hwrng_example.py # Example: hardware RNG usage
18
+
process_inspect_example.py # Example: process metrics usage
19
+
src/
20
+
hRng.c # C source for hardware RNG DLL
21
+
processInspect.c # C source for process inspection DLL
22
+
tool/
23
+
compilerHelper.ps1 # PowerShell script to build DLLs for x86/x64
24
+
dist/
25
+
x64/ # Compiled DLLs for 64-bit
26
+
x86/ # Compiled DLLs for 32-bit
27
+
```
81
28
82
29
## Building the DLLs
83
30
84
-
1. Open **PowerShell** and run:
85
-
```powershell
86
-
cd ./tool/
87
-
compilerHelper.ps1
88
-
```
89
-
90
-
2. Choose the `.c` source files you want to compile.
91
-
92
-
3. The script will compile for **both x86 and x64** architectures, placing the output in:
93
-
-`bin/x86` (32-bit builds)
94
-
-`bin/x64` (64-bit builds)
95
-
96
-
> [!IMPORTANT]
97
-
> The build process uses `cl.exe` from the **MSVC toolchain** in Visual Studio, so make sure it’s installed and available in your PATH.
98
-
99
-
> [!NOTE]
100
-
> - Each compiled source produces **four files per architecture**: `.dll`, `.exp`, `.lib`, and `.obj`.
101
-
>
102
-
> - Only the `.dll` is needed by the Python library.
103
-
>
104
-
> - DLL filenames include an architecture suffix:
105
-
>
106
-
> - Example: `hRng_x86.dll`, `hRng_x64.dll`.
31
+
1. Open PowerShell and run `tool/compilerHelper.ps1`.
32
+
2. Select which `.c` files to compile.
33
+
3. The script will build both x86 and x64 DLLs and place them in `dist/x86` and `dist/x64`.
107
34
108
35
## Using the Python Library
109
36
110
-
- Place the `dist/` folder inside the `pyCTools` package directory, or at max two levels up the library.
111
-
- Import and use `hwrng` or `processInspect` from `pyCTools`.
112
-
- The library will automatically load the correct DLL based on your Python interpreter architecture (x86 or x64).
37
+
- Place the `dist/` folder as a sibling to your Python scripts or as described in the wrappers.
38
+
- Import and use `pyCTools.hwrng` or `pyCTools.processInspect` as shown in the examples.
39
+
40
+
## Example Usage
113
41
114
-
> [!TIP]
115
-
> Example usages for both modules in detail:
116
-
>
117
-
> #### Hardware RNG
118
-
> Either check out the [example script](example/hwrng_example.py) or the [Wiki page](https://github.com/DefinetlyNotAI/PyCTools/wiki/Py-Documentation-‐-hwrng#methods)
119
-
>
120
-
> #### Process Inspection
121
-
> Either check out the [example script](example/process_inspect_example.py) or the [Wiki page](https://github.com/DefinetlyNotAI/PyCTools/wiki/Py-Documentation-‐-processInspect#methods)
42
+
**Hardware RNG:**
43
+
```python
44
+
from pyCTools.hwrng import get_hardware_random_bytes
45
+
rb = get_hardware_random_bytes(16)
46
+
print(rb.hex())
47
+
```
122
48
123
-
### DLL Discovery
49
+
**Process Inspection:**
50
+
```python
51
+
from pyCTools.processInspect import ProcessMetrics
The Python wrappers automatically search for the correct DLL in:
126
62
-`./dist/{arch}/<dll>`
@@ -129,14 +65,7 @@ The Python wrappers automatically search for the correct DLL in:
129
65
130
66
where `{arch}` is `x64` or `x86` depending on your Python interpreter.
131
67
132
-
> More details on how the DLL discovery works can be found in the [Wiki page](https://github.com/DefinetlyNotAI/PyCTools/wiki#dll-discovery-and-dist-directory)
133
-
134
-
## Extra resources
68
+
## License
135
69
136
-
> [!TIP]
137
-
> Want to dive deeper into how everything works? Head over to the [PyCTools Wiki](https://github.com/DefinetlyNotAI/PyCTools/wiki) for detailed breakdowns of the key parts:
138
-
>
139
-
> • **DLL explanations**: learn how the DLLs are structured, discovered, and loaded
140
-
> • **Python examples, wrappers, and usage**: practical code snippets and usage patterns in Python
141
-
> • **C code explanation**: understand the underlying native implementation
0 commit comments