Euro-pol / hypno

Inject python code into a running python process

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hypno

PyPI version PyPI Supported Python Versions GitHub license Tests (GitHub Actions) chat

A cross-platform tool/library allowing to inject python code into a running python process. Based on kmaork/pyinjector.

If you are trying to debug a python process, check out kmaork/madbg.

Installation

pip install hypno

Both source distributions, manylinux, musslinux and windows wheels are uploaded to pypi for every release.

Usage

CLI

hypno <pid> <python_code>

API

from hypno import inject_py

inject_py(pid, python_code)

Example

This example runs a python program that prints its pid, and then attaches to the newly created process and injects it with another print statement using hypno.

python -c "import os, time; print('Hello from', os.getpid()); time.sleep(0.5)" &\
hypno $! "import os; print('Hello again from', os.getpid())"

About

Inject python code into a running python process

License:MIT License


Languages

Language:Python 80.4%Language:C 19.6%