惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

A
About on SuperTechFans
有赞技术团队
有赞技术团队
人人都是产品经理
人人都是产品经理
月光博客
月光博客
美团技术团队
博客园 - 聂微东
阮一峰的网络日志
阮一峰的网络日志
WordPress大学
WordPress大学
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园_首页
爱范儿
爱范儿
G
Google Developers Blog
aimingoo的专栏
aimingoo的专栏
T
The Blog of Author Tim Ferriss
MongoDB | Blog
MongoDB | Blog
小众软件
小众软件
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
IT之家
IT之家
I
InfoQ
B
Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
大猫的无限游戏
大猫的无限游戏
T
Tailwind CSS Blog
F
Fortinet All Blogs

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
paker: load encrypted Python packages from memory
Wojciech Wen · 2026-05-06 · via DEV Community

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.run()

Enter fullscreen mode Exit fullscreen mode

No pip install on the client. Python modules get compiled from memory. Native extensions load through platform-specific loaders. numpy, pydantic, boto3, Pillow, anthropic, and a dozen more packages all work, including ones with compiled C code.

How it loads

paker implements zero-disk loading natively on Windows and Linux. macOS requires an ephemeral temp file (written, loaded, immediately deleted) because of mandatory code signing, and the host binary needs the disable-library-validation entitlement. I'll go into the platform-specific details in a separate post.

What it doesn't protect against

Once loaded, modules live in sys.modules as normal Python objects. Someone with access to the running process can inspect bytecode through marshal.dumps(func.__code__) or walk the heap with gc.get_objects(). Compiled code objects stay resident in the process. mlock and MADV_DONTDUMP keep them out of core dumps, not out of the address space.

A determined attacker with the key and a debugger gets through. This is defense in depth against casual reverse engineering. If someone with a valid license wants to spend a week extracting bytecode, the real protection is legal, not technical.

What paker does protect: the bundle at rest. Without the key, the encrypted payloads are AES-256-CTR + HMAC-SHA256 ciphertext. The key and the bundle always travel separately, through whatever key management you already have (license server, HSM, environment variable). paker handles encryption and loading. Key distribution is your problem.

Transform hooks

paker ships hooks instead of a built-in obfuscator. Pass any callable as ast_transform or code_transform:

import ast, paker

def strip_docstrings(tree: ast.AST, module_name: str) -> ast.AST:
    for node in ast.walk(tree):
        if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef,
                             ast.ClassDef, ast.Module)):
            if ast.get_docstring(node):
                node.body.pop(0)
    return tree

bundle = paker.dumps("myapp", key=KEY, ast_transform=strip_docstrings)

Enter fullscreen mode Exit fullscreen mode

There's also a code_transform hook for bytecode-level passes. I spent days building a built-in obfuscator before I understood my own threat model well enough to realize I didn't need one. Separate post coming on that.

Install

pip install paker

Enter fullscreen mode Exit fullscreen mode

Source, docs, examples (including a remote agent that ships the anthropic SDK over TCP to a zero-install client): github.com/desty2k/paker.