Skip to content

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

License

Notifications You must be signed in to change notification settings

DefinetlyNotAI/PyCTools

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:
      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 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 PowerShell script Visual Studio Build Tools + PowerShell
Prebuilt Release Archive Download precompiled binaries from the releases page 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 OR check the Wiki 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

Module usage documentation

DLL Info

You can find all information in the Wiki.

Details about building the DLLs can be found in more detail here

Extra resources

Tip

Want to dive deeper into how everything works? Head over to the 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

About

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

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks