saucesteals / pypatch

Inject arbitrary code into any running python interpreter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

logo

PyPatch

Inject arbitrary code into any running python interpreter

Supports all configurations of PyInstaller and PyArmor


Overview

pypatch includes:

Usage

  • Write the payload you want to inject in inject.py
  • Compile a DLL with the payload with make dll
  • Compile an injector (in cmd/injector) with your program and dll paths

Example

program.py obfuscated with pyarmor 8.4.2 and packed with pyinstaller 6.1.0

import time

def main():
  while True:
    print("Working")
    time.sleep(1)

if __name__ == "__main__":
  main()

logo

Injecting inject.py with pypatch executor before startup

import os
print("Hello from inject.py!")
print = lambda *args, **kwargs: os.write(1, b"Boo!\n")

logo


Contributing

Contributions are welcome!

License

Distributed under the GNU GPL v3.0 License. See LICENSE for more information.

About

Inject arbitrary code into any running python interpreter

License:GNU General Public License v3.0


Languages

Language:Go 89.9%Language:C 4.8%Language:Makefile 4.1%Language:Python 1.2%