PyLi is a minimal Linux distribution designed for running python code in a sandboxed one time environment. It exposes a lightweight binary protocol over TCP that allows clients to define and execute Python code remotely.
This document describes the PyLi daemon protocol, message format, and usage patterns based on the reference Python client.
The PyLi daemon listens on a TCP socket (default: 0.0.0.0:9000) and accepts two types of operations:
| Mode | Meaning | Description |
|---|---|---|
D |
Define | Upload Python code (functions, classes, variables) that persists in the daemon environment |
R |
Run | Execute Python code or evaluate an expression and return the result |
The client compiles Python code locally, serializes it using marshal, and sends it to the daemon.
Each message sent to the daemon has the following structure:
| Field | Size | Description |
|---|---|---|
| Mode | 1 byte | Operation mode: D (Define) or R (Run) |
| Payload length | 4 bytes | Big‑endian unsigned integer |
| Marshalled code | N bytes | marshal.dumps() of compiled Python code |
in client.py is an example how to use it
- README.md: the docs of the code
- daemon.c: the compiled daemon used in the mini distro
- create.sh: creates an binary that you can run on qemu
- create-iso.sh: creates an iso that you can use on your computer
- precompiled.iso: a precompiled version so you don't have to.
PyLi doesn't use any form of encryption or password. You have to created an apart wifi network to keep it save