An open API service indexing awesome lists of open source software.

https://github.com/definetlynotai/pyctools

This project provides a cross-language toolkit for Windows process inspection and hardware random number generation, with both Python and C components.
https://github.com/definetlynotai/pyctools

c dll hrng proccess-dump process-info process-snapshot python python-dll python-lib rng tools

Last synced: about 1 month ago
JSON representation

This project provides a cross-language toolkit for Windows process inspection and hardware random number generation, with both Python and C components.

Awesome Lists containing this project

README

          


PyCTools


License
Platform
Languages
Version

> [!NOTE]
> There are multiple ways to install the pyCTools library!
>
> * **Manual installation:**
>
> 1. Clone the repository and build the DLLs yourself.
> 2. Update the `VERSION` variable in `pyCTools/__init__.py` to match your desired version for the build.
> 3. Run the following to create the wheel file:
> ```bash
> pip install build
> cd tool
> python setupHelper.py # Do not run `setup.py` directly, use this script instead as it handles many important things
> ```
> 4. The setup script will show you how to install the package locally with pip and how to create a virtual environment for testing.
> * **Automatic installation:**
> 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
> [Auto installation support from v0.2.0-beta and above]

This project provides a cross-language toolkit for Windows process inspection and hardware random number generation, with both Python and C components. It includes:

- **Python library (`pyCTools`)**: Easy-to-use wrappers for native DLLs to access process metrics and hardware RNG.
- **C source files**: Implement the DLLs for process inspection and hardware RNG.
- **Example Python scripts**: Demonstrate usage of the library.
- **PowerShell build helper**: Automates DLL compilation for x86/x64.

> [!IMPORTANT]
> To get the `dist` binary folder, choose **one** of the following options:
>
> | Method | Description | Requirements |
> |--------------------------|--------------------------------------------------------------------------------------------------------------|-----------------------------------------------------|
> | Manual Build | Compile the binaries yourself using `cl.exe` or similar toolchains | Microsoft Visual Studio with MSVC installed |
> | Auto Build Script | Run the [`tool/compilerHelper.ps1`](tool/compilerHelper.ps1) PowerShell script | Visual Studio Build Tools + PowerShell |
> | 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 |
>
> 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-bin-directory) page about the DLL discovery explanation.

## Directory Structure

📁 Project Structure (click to expand)

root/
├── dist/ # Release artifacts for distribution
│ ├── rawBinaryZipped/ # Prebuilt binaries files (generated by `distributionHelper.ps1`)
│ │ ├── bin.zip # Zipped prebuilt binaries
│ │ └── bin.zip.sha256 # SHA256 checksum for `bin.zip`
│ └── libraryWheel/ # Library wheel files (generated by `setup.py`)
│ └── *.whl # Python wheel files for library distribution via pip

├── pyCTools/ # Python package (library code)
│ ├── bin/ # Auto-generated folder containing compiled DLL binaries
│ │ ├── x86/ # 32-bit DLL builds
│ │ └── x64/ # 64-bit DLL builds
│ ├── __init__.py # Package initializer
│ ├── hwrng.py # Hardware RNG DLL wrapper
│ ├── processInspect.py # Process inspection DLL wrapper
│ ├── _loadDLL.py # DLL loading logic used by wrappers
│ └── setup.py # Setup script for building and installing the package

├── tool/ # Build and distribution tools
│ ├── compilerHelper.ps1 # Compiles C code into DLLs
│ └── distributionHelper.ps1 # Creates `bin.zip` and SHA256 checksum

├── src/ # C source code for DLLs
│ ├── hRng.c # Hardware RNG implementation
│ └── processInspect.c # Process inspection implementation

└── CMakeLists.txt # CMake build configuration (currently unused)

## Using the Python Library

- Place the `dist/` folder inside the `pyCTools` package directory.
- Import and use `hwrng` or `processInspect` from `pyCTools`.
- The library will automatically load the correct DLL based on your Python interpreter architecture (x86 or x64).

### Module examples and documentation

Example usages and documentation for both modules in detail can be found in the Wiki:

#### Script usage examples

- [Hardware RNG Example Script](example/hwrng.py)
- [Process Inspection Example Script](example/processInspect.py)

#### Module usage documentation
- [Hardware RNG Documentation Wiki page](https://github.com/DefinetlyNotAI/PyCTools/wiki/Py-Documentation-‐-hwrng#methods)
- [Process Inspection Documentation Wiki page](https://github.com/DefinetlyNotAI/PyCTools/wiki/Py-Documentation-‐-processInspect#methods)

### DLL Info

You can find all information in the [Wiki](https://github.com/DefinetlyNotAI/PyCTools/wiki#dll-discovery-and-bin-directory).

Details about building the DLLs can be found in more detail [here](https://github.com/DefinetlyNotAI/PyCTools/wiki#building-the-dlls)

## Extra resources

> [!TIP]
> 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:
>
> • **DLL explanations**: learn how the DLLs are structured, discovered, and loaded
>
> • **Python examples, wrappers, and usage**: practical code snippets and usage patterns in Python
>
> • **C code explanation**: understand the underlying native implementation
>
> • **Build and distribution**: how to compile, package, and distribute the libraries