https://github.com/florararie/injectpy
A lightweight DLL injector for Windows written in Python.
https://github.com/florararie/injectpy
dll dll-hooking dll-injection dll-injector python python-3 python3
Last synced: 7 months ago
JSON representation
A lightweight DLL injector for Windows written in Python.
- Host: GitHub
- URL: https://github.com/florararie/injectpy
- Owner: Florararie
- License: mit
- Created: 2025-09-04T03:01:36.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-10-17T06:42:38.000Z (8 months ago)
- Last Synced: 2025-10-18T07:36:43.272Z (8 months ago)
- Topics: dll, dll-hooking, dll-injection, dll-injector, python, python-3, python3
- Language: Python
- Homepage:
- Size: 29.3 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# injectpy
A lightweight DLL injector for Windows written in Python.
> [!WARNING]
> To avoid a Windows Defender false positive, this module disables .pyc bytecode generation only for itself, so you can use it safely alongside other Python modules.
>
> You may still get a warning if globally installing the package for the first time though.
## Features
- Inject DLLs into processes by PID or process name
- Automatic handling of multiple processes with the same name
- Architecture check (x86/x64) before injection
## Installation
Clone the repo and install:
```cmd
git clone https://github.com/Florararie/injectpy.git
cd injectpy
pip install .
```
## Usage
Command-Line
```cmd
usage: injectpy [-h] [--index INDEX] [--timeout TIMEOUT] [--verbose] (--inject | --eject | --status | --list) [--force] target [dll]
injectpy DLL injection tool
positional arguments:
target PID (int) or process name (str)
dll Path to DLL to inject/eject
options:
-h, --help show this help message and exit
--index INDEX Which process index if multiple
--timeout TIMEOUT Timeout in ms (default 5000)
--verbose Enable verbose logging
--inject Inject the DLL
--eject Eject the DLL
--status Check if the DLL is loaded
--list List processes for the target name
--force Force reinject by ejecting first if already loaded
```
Example
```cmd
injectpy notepad.exe C:\path\to\my.dll --verbose --inject --timeout 5000 --index 0
```
Python API
```python
from injectpy import Injector, InjectionResult
injector = Injector(verbose=True)
result = injector.inject("notepad.exe", r"C:\path\to\my.dll")
if result == InjectionResult.SUCCESS:
print("DLL injected successfully!")
else:
print(f"Injection failed: {result.value}")
```
## License
MIT License - see [LICENSE](/LICENSE) for details