Menu

paker: load encrypted Python packages from memory
🖼️

paker: load encrypted Python packages from memory

DEV Community·Wojciech Wentland·6 months ago
#tj4XRzJo
#python#security#opensource#programming#paker
Reading 0:00
15s threshold

Ship Python code without leaving source on disk. Encrypted bundles arrive at runtime, load from memory. Works with numpy, pydantic, boto3.

PyInstaller bundles Python code into a standalone binary. Run pyinstxtractor on that binary and you get every .pyc back in about ten seconds. uncompyle6 turns those into readable source. The "compiled" binary is a zip file with extra steps.

paker takes a different approach. The binary ships without the proprietary code. At runtime, encrypted modules arrive from the network and load directly into memory.

import paker , requests

# Key arrives from your license server. paker doesn't manage keys. key = requests . post ( " https://license.example.com/key " , json = { " license " : LICENSE_ID }). content

# loads() accepts dict, str, bytes, or bytearray. bundle = requests . get ( " https://cdn.example.com/sdk.paker " ). json ()

with paker . loads ( bundle , key = key ): import proprietary_sdk proprietary_sdk .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.