Skip to content

acureau/pynject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Screenshot

A Windows application for injecting code into live python processes. What makes Pynject different from other injectors is that it does not rely on GDB to do the heavy lifting. Pynject scans the system for running python processes, and uses DLL injection to run code using the Python C API.

Installation & Usage

Pre-compiled binaries for x64 and x86 systems can be downloaded from the releases page. It is strongly recommended that you add pynject to your PATH for ease of access.

Building from Source

Download and install Visual Studio if you have not already. Open the project file in the 'src' directory. Build both solutions for your target architecture, and ensure that 'executor.dll' is in the same directory as pynject before execution.

You can also use the build script to automatically build binaries for both x64 and x86 systems. First add MSBuild to your path. In Visual Studio Community 2022, you can find it here.

C:\Program Files\Microsoft Visual Studio\2022\Community\Msbuild\Current\Bin\MSBuild.exe

In the project root, run the following command and find a release archive in the '.builds' directory.

py build.py release

Usage

Pynject has two functions. To scan your system for running python processes, use the scan command.

C:\>pynject scan
Python Processes
================
  Base: python.exe | Version: python39.dll | PID: 53736

To inject a sript, pass both the process PID and a path to your script as arguments.

C:\>pynject 53736 script.py

Pynject Standard Payloads (DEPRECATED)

Pynject comes bundled with pre-written scripts which you may find useful. Documentation for these payloads can be found here. The current list official payloads is as follows.

  • Pynject Executor (v1.1)
  • Pynject Inspector (v1.0)

Contributing

If you'd like to contribute, please check out the page below first. If you haven't changed your mind, feel free to pick any of the goals listed and hack away. I'd really appreciate it!

The Future

Pynject's scope has changed! If you are interested, please read this page detailing the future plans.

Credits

Developed and maintained by am-nobody.
Inspired by lmacken's pyrasite & contributors.