Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/segevfiner/cyminhook
Hook functions using Python on Windows with MinHook
https://github.com/segevfiner/cyminhook
cython minhook python python3
Last synced: 5 days ago
JSON representation
Hook functions using Python on Windows with MinHook
- Host: GitHub
- URL: https://github.com/segevfiner/cyminhook
- Owner: segevfiner
- License: mit
- Created: 2022-01-16T13:29:26.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-17T09:11:55.000Z (7 months ago)
- Last Synced: 2024-10-29T06:42:05.007Z (15 days ago)
- Topics: cython, minhook, python, python3
- Language: Cython
- Homepage: https://pypi.org/project/cyminhook/
- Size: 237 KB
- Stars: 15
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
cyminhook
=========
.. image:: https://img.shields.io/pypi/v/cyminhook.svg
:target: https://pypi.org/project/cyminhook/
:alt: PyPI.. image:: https://github.com/segevfiner/cyminhook/actions/workflows/docs.yml/badge.svg
:target: https://segevfiner.github.io/cyminhook/
:alt: DocsHook functions on Windows using `MinHook `_.
Quick Start:
.. code-block:: python
import ctypes
import ctypes.wintypes
import cyminhook
import win32api
import win32conclass MessageBoxExWHook(cyminhook.MinHook):
signature = ctypes.WINFUNCTYPE(
ctypes.c_int,
ctypes.wintypes.HWND,
ctypes.wintypes.LPCWSTR,
ctypes.wintypes.LPCWSTR,
ctypes.wintypes.UINT,
ctypes.wintypes.WORD,
use_last_error=True,
)target = ctypes.windll.user32.MessageBoxExW
def detour(self, hWnd, lpText, lpCaption, uType, langId):
return self.original(hWnd, "Hooked", "Hooked", uType, langId)with MessageBoxExWHook() as hook:
hook.enable()win32api.MessageBox(None, "Hello, World!", "Python", win32con.MB_OK)