Skip to content

rhotav/pyinjector-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pyinjector-rs

A Windows process injector written in Rust that can inject and execute Python scripts in running processes.

Note

This injector uses the pythonX.dll file that is already loaded on the process. It does not inject an additional Python DLL onto the process!

Docs

For detailed technical explanation, see the Technical Documentation.

Usage

Execute a Python command:

pyinjector.exe --pid <PID> --command "print('Hello from injected code!')"

Inject a Python script file:

pyinjector.exe --pid <PID> --script script.py

Examples

Simple Message Box

pyinjector.exe --pid 1234 --command "import ctypes; ctypes.windll.user32.MessageBoxW(0, 'Injected!', 'PyInjector', 0)"

Execute Script File

Create test.py:

import sys
import os
print(f"Python {sys.version} running in PID {os.getpid()}")

Inject it:

pyinjector.exe --pid 1234 --script test.py

Building

On Windows

cargo build --release

Cross-compilation from Linux/macOS

Install the Windows target:

rustup target add x86_64-pc-windows-gnu

Build for Windows:

cargo build --release --target x86_64-pc-windows-gnu

Acknowledgements

I would like to thank Melih Kaan Yıldız for giving me the idea for pyinjector.

About

A Windows process injector written in Rust that injects and executes Python codes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages