pykevlar 2.0.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pykevlar/__init__.py ADDED
@@ -0,0 +1,6 @@
1
+ """PyKevlar — High-speed Python obfuscator, Anti-LLM shield, and single-binary compiler."""
2
+
3
+ from ._cli import get_binary_path, main
4
+
5
+ __version__ = "2.0.3"
6
+ __all__ = ["__version__", "get_binary_path", "main"]
pykevlar/__main__.py ADDED
@@ -0,0 +1,4 @@
1
+ from ._cli import main
2
+
3
+ if __name__ == "__main__":
4
+ raise SystemExit(main())
pykevlar/_cli.py ADDED
@@ -0,0 +1,96 @@
1
+ """Native binary locator and sdist fallback fetcher for the standalone Rust+C `pykevlar` CLI."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import hashlib
6
+ import io
7
+ import os
8
+ import platform
9
+ import stat
10
+ import sys
11
+ import tarfile
12
+ import urllib.request
13
+ from pathlib import Path
14
+
15
+ VERSION = "2.0.2"
16
+ RELEASE_BASE = os.environ.get("PYKEVLAR_RELEASE_CDN", "https://releases.pykevlar.com/latest")
17
+
18
+
19
+ def _detect_target_triple() -> str:
20
+ sys_name = platform.system().lower()
21
+ machine = platform.machine().lower()
22
+ if sys_name == "darwin" and machine in ("arm64", "aarch64"):
23
+ return "aarch64-apple-darwin"
24
+ if sys_name == "darwin" and machine in ("x86_64", "amd64"):
25
+ return "x86_64-apple-darwin"
26
+ if sys_name == "linux" and machine in ("x86_64", "amd64"):
27
+ return "x86_64-unknown-linux-gnu"
28
+ if sys_name == "linux" and machine in ("arm64", "aarch64"):
29
+ return "aarch64-unknown-linux-gnu"
30
+ raise RuntimeError(
31
+ f"Unsupported platform ({sys_name}/{machine}). Visit https://pykevlar.com/docs for supported targets."
32
+ )
33
+
34
+
35
+ def _ensure_executable(path: Path) -> Path:
36
+ mode = path.stat().st_mode
37
+ if not (mode & stat.S_IXUSR):
38
+ path.chmod(mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
39
+ return path
40
+
41
+
42
+ def _download_verified_binary() -> Path:
43
+ triple = _detect_target_triple()
44
+ cache_dir = Path(os.environ.get("PYKEVLAR_CACHE_DIR", Path.home() / ".cache" / "pykevlar" / f"v{VERSION}" / triple))
45
+ bin_path = cache_dir / "pykevlar"
46
+ if bin_path.is_file():
47
+ return _ensure_executable(bin_path)
48
+
49
+ tar_name = f"pykevlar-{triple}.tar.gz"
50
+ tar_url = f"{RELEASE_BASE}/{tar_name}"
51
+ sha_url = f"{tar_url}.sha256"
52
+
53
+ sys.stderr.write(f"[pykevlar] Fetching native binary {tar_name} from {RELEASE_BASE}...\n")
54
+ with urllib.request.urlopen(sha_url, timeout=20) as r:
55
+ expected_sha = r.read().decode("utf-8").strip().split()[0].lower()
56
+ with urllib.request.urlopen(tar_url, timeout=60) as r:
57
+ tar_bytes = r.read()
58
+
59
+ actual_sha = hashlib.sha256(tar_bytes).hexdigest().lower()
60
+ if actual_sha != expected_sha:
61
+ raise RuntimeError(f"SHA-256 mismatch for {tar_url}: expected {expected_sha}, got {actual_sha}")
62
+
63
+ cache_dir.mkdir(parents=True, exist_ok=True)
64
+ with tarfile.open(fileobj=io.BytesIO(tar_bytes), mode="r:gz") as tf:
65
+ for member in tf.getmembers():
66
+ if Path(member.name).name == "pykevlar" and member.isfile():
67
+ extracted = tf.extractfile(member)
68
+ if extracted is None:
69
+ continue
70
+ tmp_path = cache_dir / "pykevlar.tmp"
71
+ tmp_path.write_bytes(extracted.read())
72
+ _ensure_executable(tmp_path)
73
+ tmp_path.replace(bin_path)
74
+ return bin_path
75
+
76
+ raise RuntimeError(f"Archive {tar_name} did not contain `pykevlar` binary")
77
+
78
+
79
+ def get_binary_path() -> Path:
80
+ bundled = Path(__file__).resolve().parent / "bin" / "pykevlar"
81
+ if bundled.is_file():
82
+ return _ensure_executable(bundled)
83
+ return _download_verified_binary()
84
+
85
+
86
+ def main(argv: list[str] | None = None) -> int:
87
+ args = sys.argv[1:] if argv is None else list(argv)
88
+ if args and args[0] == "audit":
89
+ from .auditor import run_cli_audit
90
+ return run_cli_audit(args[1:])
91
+ if args and args[0] == "mcp":
92
+ from .mcp_server import main as run_mcp
93
+ return run_mcp()
94
+ bin_path = get_binary_path()
95
+ os.execv(str(bin_path), [str(bin_path), *args])
96
+ return 0
pykevlar/auditor.py ADDED
@@ -0,0 +1,183 @@
1
+ """
2
+ PyKevlar Local Exposure & Decompiler Risk Auditor (`pykevlar audit <dir>`).
3
+ Product-Led Growth (PLG) diagnostic tool: scans a local Python repository in milliseconds,
4
+ quantifies exposure to `pyinstxtractor`, `PyLingual`, `strings` prompt/secret extraction, and
5
+ slow PyInstaller/PyArmor builds, and outputs a tailored `pykevlar build` production command.
6
+ """
7
+ from __future__ import annotations
8
+
9
+ import ast
10
+ import os
11
+ import re
12
+ import sys
13
+ import time
14
+ from pathlib import Path
15
+
16
+ SKIP_DIRS = {
17
+ ".git", ".hg", ".svn", ".venv", "venv", "env", "__pycache__",
18
+ "node_modules", "dist", "build", ".mypy_cache", ".pytest_cache", ".ruff_cache", ".tox",
19
+ }
20
+
21
+ SENSITIVE_PATTERNS = [
22
+ ("LLM System Prompt / Agent Instruction", re.compile(r"\b(you are a|system_prompt|instructions\s*=|anthropic|openai|langchain|langgraph)\b", re.I)),
23
+ ("SQL / Database Query Literal", re.compile(r"\b(SELECT\s+.+\s+FROM|INSERT\s+INTO|UPDATE\s+\w+\s+SET)\b", re.I)),
24
+ ("API Endpoint / Secret Identifier", re.compile(r"\b(api[_-]?key|secret[_-]?key|bearer\s+|webhook|private[_-]?key|https://api\.)\b", re.I)),
25
+ ("Proprietary Pricing / Trading Formula", re.compile(r"\b(sharpe|drawdown|orderbook|margin|commission|royalty|tier_price|license_key)\b", re.I)),
26
+ ]
27
+
28
+ FRAMEWORK_HINTS = {
29
+ "fastapi": ("FastAPI", "--collect-submodules fastapi --collect-submodules uvicorn"),
30
+ "django": ("Django", "--collect-submodules django --collect-submodules gunicorn.workers"),
31
+ "flask": ("Flask", "--collect-submodules flask"),
32
+ "torch": ("PyTorch / ML", "--exclude-module pytest"),
33
+ "PySide6": ("PySide6 Desktop", "--collect-submodules PySide6"),
34
+ "PyQt6": ("PyQt6 Desktop", "--collect-submodules PyQt6"),
35
+ "ccxt": ("Crypto / Quant Trading", "--collect-submodules ccxt"),
36
+ "langchain": ("LangChain AI Agent", "--mix-str --anti-llm"),
37
+ "openai": ("OpenAI Agent", "--mix-str --anti-llm"),
38
+ }
39
+
40
+
41
+ def scan_repository(target: Path) -> dict:
42
+ t0 = time.perf_counter()
43
+ root = target.resolve()
44
+ py_files: list[Path] = []
45
+ spec_files: list[Path] = []
46
+ has_dockerfile = (root / "Dockerfile").is_file()
47
+
48
+ if root.is_file() and root.suffix == ".py":
49
+ py_files.append(root)
50
+ root = root.parent
51
+ else:
52
+ for dirpath, dirnames, filenames in os.walk(root):
53
+ dirnames[:] = [d for d in dirnames if d not in SKIP_DIRS and not d.startswith(".venv")]
54
+ for fn in filenames:
55
+ p = Path(dirpath) / fn
56
+ if fn.endswith(".py"):
57
+ py_files.append(p)
58
+ elif fn.endswith(".spec"):
59
+ spec_files.append(p)
60
+
61
+ total_loc = 0
62
+ total_funcs = 0
63
+ bcc_candidates = 0
64
+ sensitive_hits: list[dict] = []
65
+ detected_frameworks: dict[str, tuple[str, str]] = {}
66
+ top_packages: set[str] = set()
67
+ entry_candidate: str | None = None
68
+
69
+ for pf in py_files[:2500]:
70
+ rel = pf.relative_to(root)
71
+ if len(rel.parts) > 1:
72
+ top_packages.add(rel.parts[0])
73
+ if pf.name in ("main.py", "app.py", "manage.py", "run.py", "server.py", "cli.py") and entry_candidate is None:
74
+ entry_candidate = str(rel)
75
+
76
+ try:
77
+ src = pf.read_text(encoding="utf-8", errors="ignore")
78
+ except Exception:
79
+ continue
80
+ lines = src.splitlines()
81
+ total_loc += len(lines)
82
+
83
+ for fw_key, fw_info in FRAMEWORK_HINTS.items():
84
+ if fw_key in src:
85
+ detected_frameworks[fw_key] = fw_info
86
+
87
+ for label, pat in SENSITIVE_PATTERNS:
88
+ if len(sensitive_hits) < 12 and pat.search(src):
89
+ sensitive_hits.append({"file": str(rel), "kind": label})
90
+ break
91
+
92
+ try:
93
+ tree = ast.parse(src)
94
+ for node in ast.walk(tree):
95
+ if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)):
96
+ total_funcs += 1
97
+ if isinstance(node, ast.FunctionDef) and not any(isinstance(n, ast.Yield) for n in ast.walk(node)):
98
+ bcc_candidates += 1
99
+ except Exception:
100
+ pass
101
+
102
+ elapsed_ms = round((time.perf_counter() - t0) * 1000.0, 1)
103
+ n_mod = max(1, len(py_files))
104
+ est_pykevlar_s = round(0.45 + n_mod * 0.0011, 2)
105
+ est_legacy_s = round(14.0 + n_mod * 0.045, 1)
106
+
107
+ protect_pkgs = sorted(p for p in top_packages if p not in ("tests", "test", "docs", "scripts", "migrations"))[:4]
108
+ protect_flags = " ".join(f"--protect {p}" for p in protect_pkgs) if protect_pkgs else ""
109
+ fw_flags = " ".join(dict.fromkeys(v[1] for v in detected_frameworks.values() if not v[1].startswith("--mix")))
110
+ entry = entry_candidate or (str(py_files[0].relative_to(root)) if py_files else "main.py")
111
+
112
+ recommended_tier = "Team ($79/yr)" if (has_dockerfile or len(py_files) > 50) else "Pro ($39/yr)"
113
+ recommended_cmd = (
114
+ f"pykevlar build {entry} {protect_flags} --mix-str --enable-bcc --anti-llm --outer {fw_flags} -F -O dist"
115
+ )
116
+ recommended_cmd = re.sub(r"\s+", " ", recommended_cmd).strip()
117
+
118
+ risk_score = min(99, 55 + min(25, len(sensitive_hits) * 4) + (10 if spec_files else 0) + (9 if has_dockerfile else 0))
119
+
120
+ return {
121
+ "root": str(root),
122
+ "scan_ms": elapsed_ms,
123
+ "python_files": len(py_files),
124
+ "total_loc": total_loc,
125
+ "functions": total_funcs,
126
+ "native_c_bcc_candidates": bcc_candidates,
127
+ "sensitive_string_files": sensitive_hits,
128
+ "pyinstaller_specs_found": [str(s.relative_to(root)) for s in spec_files],
129
+ "has_dockerfile": has_dockerfile,
130
+ "frameworks": [v[0] for v in detected_frameworks.values()],
131
+ "exposure_score_out_of_100": risk_score,
132
+ "estimated_pykevlar_build_s": est_pykevlar_s,
133
+ "estimated_legacy_build_s": est_legacy_s,
134
+ "recommended_tier": recommended_tier,
135
+ "recommended_command": recommended_cmd,
136
+ "free_bundle_command": f"pykevlar build {entry} --no-armor -F -O dist",
137
+ "upgrade_url": "https://pykevlar.com/#pricing",
138
+ }
139
+
140
+
141
+ def run_cli_audit(args: list[str]) -> int:
142
+ import json as _json
143
+
144
+ as_json = "--json" in args
145
+ clean_args = [a for a in args if a != "--json"]
146
+ target = Path(clean_args[0]) if clean_args else Path.cwd()
147
+ if not target.exists():
148
+ sys.stderr.write(f"error: path not found: {target}\n")
149
+ return 1
150
+
151
+ rep = scan_repository(target)
152
+ if as_json:
153
+ print(_json.dumps(rep, indent=2))
154
+ return 0
155
+
156
+ print(f"\nPyKevlar Reverse-Engineering & IP Exposure Audit ({rep['scan_ms']} ms)")
157
+ print("=" * 70)
158
+ print(f" Target Project : {rep['root']}")
159
+ print(f" First-Party Code : {rep['python_files']} .py modules · {rep['total_loc']:,} LOC · {rep['functions']:,} functions")
160
+ if rep["frameworks"]:
161
+ print(f" Detected Stack : {', '.join(rep['frameworks'])}")
162
+ print(f" Exposure Risk Score : {rep['exposure_score_out_of_100']}/100 (HIGH — 100% recoverable if shipped as .py/.pyc/PyInstaller)")
163
+ print("-" * 70)
164
+ print(" Attack Surface Findings:")
165
+ print(f" [!] Bytecode Decompilation : All {rep['functions']:,} functions unpack in <3s via pyinstxtractor + PyLingual 3.13")
166
+ print(f" [!] Native C Eligible : {rep['native_c_bcc_candidates']:,} functions can compile straight to stripped C (--enable-bcc)")
167
+ if rep["sensitive_string_files"]:
168
+ print(f" [!] Plaintext String Leaks : {len(rep['sensitive_string_files'])} module(s) contain prompts/SQL/API constants visible to `strings`:")
169
+ for item in rep["sensitive_string_files"][:5]:
170
+ print(f" - {item['file']} ({item['kind']})")
171
+ if rep["has_dockerfile"]:
172
+ print(" [!] Container Exposure : Dockerfile detected — `docker exec` / image layers expose raw Python IP unless sealed")
173
+ if rep["pyinstaller_specs_found"]:
174
+ print(f" [!] Legacy PyInstaller : {', '.join(rep['pyinstaller_specs_found'])} embeds unencrypted zlib CArchive headers")
175
+
176
+ print("-" * 70)
177
+ print(f" Estimated Build Speed : {rep['estimated_pykevlar_build_s']}s with PyKevlar (vs ~{rep['estimated_legacy_build_s']}s PyArmor + PyInstaller)")
178
+ print("\n 1. Test Free Plain Bundler Right Now ($0, no key needed):")
179
+ print(f" $ {rep['free_bundle_command']}")
180
+ print(f"\n 2. Seal All {rep['python_files']} Modules Against Decompilers & LLMs ({rep['recommended_tier']}):")
181
+ print(f" $ {rep['recommended_command']}")
182
+ print(f"\n Unlock Anti-Reverse-Engineering instantly -> {rep['upgrade_url']}\n")
183
+ return 0
pykevlar/mcp_server.py ADDED
@@ -0,0 +1,201 @@
1
+ """
2
+ PyKevlar Official Model Context Protocol (MCP) Server (`pykevlar-mcp`).
3
+ Zero-dependency JSON-RPC 2.0 stdio server for Claude Code, Cursor, Windsurf, Codex & Antigravity.
4
+
5
+ Quick setup:
6
+ claude mcp add pykevlar -- pykevlar-mcp
7
+ # or via uvx:
8
+ claude mcp add pykevlar -- uvx --from pykevlar pykevlar-mcp
9
+ """
10
+ from __future__ import annotations
11
+
12
+ import json
13
+ import subprocess
14
+ import sys
15
+ from pathlib import Path
16
+
17
+ from . import __version__
18
+ from ._cli import get_binary_path
19
+ from .auditor import scan_repository
20
+
21
+ TOOLS = [
22
+ {
23
+ "name": "audit_python_exposure",
24
+ "description": (
25
+ "Scan a Python/Django/FastAPI/AI repository for reverse-engineering exposure "
26
+ "(pyinstxtractor, PyLingual bytecode recovery, plaintext prompt/SQL/secret strings, "
27
+ "Docker source leaks) and generate the exact `pykevlar build` command."
28
+ ),
29
+ "inputSchema": {
30
+ "type": "object",
31
+ "properties": {
32
+ "project_dir": {
33
+ "type": "string",
34
+ "description": "Path to the Python repository or entry script to audit (defaults to current directory).",
35
+ }
36
+ },
37
+ },
38
+ },
39
+ {
40
+ "name": "check_pykevlar_license",
41
+ "description": "Check installed PyKevlar CLI version, active subscription tier (Basic Free vs Pro $39/yr vs Team $79/yr), and hardware token.",
42
+ "inputSchema": {"type": "object", "properties": {}},
43
+ },
44
+ {
45
+ "name": "bundle_python_free",
46
+ "description": (
47
+ "Compile a Python entry script into a fast standalone native executable using PyKevlar Basic (Free --no-armor mode, "
48
+ "28.8x faster PyInstaller replacement). Note: code obfuscation & anti-reverse-engineering require Pro/Team."
49
+ ),
50
+ "inputSchema": {
51
+ "type": "object",
52
+ "properties": {
53
+ "entry_script": {"type": "string", "description": "Path to main Python script (e.g. main.py)"},
54
+ "output_dir": {"type": "string", "description": "Output directory (default: dist)"},
55
+ "onefile": {"type": "boolean", "description": "Emit single-file executable (-F)", "default": True},
56
+ },
57
+ "required": ["entry_script"],
58
+ },
59
+ },
60
+ {
61
+ "name": "build_protected_release",
62
+ "description": (
63
+ "Build an obfuscated, anti-decompiler, Anti-LLM hardened commercial Python binary using PyKevlar Pro/Team "
64
+ "(ChaCha20 function vaults, SPZ2 encrypted archive, --enable-bcc native C transpilation, --outer rkey support)."
65
+ ),
66
+ "inputSchema": {
67
+ "type": "object",
68
+ "properties": {
69
+ "entry_script": {"type": "string", "description": "Path to main Python script"},
70
+ "protect_packages": {
71
+ "type": "array",
72
+ "items": {"type": "string"},
73
+ "description": "First-party package/module names to armor (e.g. ['app', 'core'])",
74
+ },
75
+ "output_dir": {"type": "string", "description": "Output directory (default: dist)"},
76
+ "enable_bcc": {"type": "boolean", "default": True},
77
+ "anti_llm": {"type": "boolean", "default": True},
78
+ "outer_rkey": {"type": "boolean", "default": False},
79
+ "target_linux": {
80
+ "type": "string",
81
+ "description": "Optional cross-compile target (Team tier): 'linux-x86_64' or 'linux-arm64'",
82
+ },
83
+ },
84
+ "required": ["entry_script"],
85
+ },
86
+ },
87
+ ]
88
+
89
+
90
+ def _call_cli(cli_args: list[str], cwd: str | None = None) -> dict:
91
+ bin_p = get_binary_path()
92
+ proc = subprocess.run([str(bin_p), *cli_args], cwd=cwd, text=True, capture_output=True, timeout=180)
93
+ return {
94
+ "exit_code": proc.returncode,
95
+ "stdout": proc.stdout[-8000:],
96
+ "stderr": proc.stderr[-8000:],
97
+ }
98
+
99
+
100
+ def _handle_tool_call(name: str, arguments: dict) -> tuple[bool, str]:
101
+ if name == "audit_python_exposure":
102
+ p = Path(arguments.get("project_dir") or ".").expanduser()
103
+ if not p.exists():
104
+ return True, f"Directory not found: {p}"
105
+ rep = scan_repository(p)
106
+ return False, json.dumps(rep, indent=2)
107
+
108
+ if name == "check_pykevlar_license":
109
+ lic = _call_cli(["license"])
110
+ hd = _call_cli(["hdinfo"])
111
+ return False, json.dumps(
112
+ {
113
+ "pykevlar_version": __version__,
114
+ "license_status": lic["stdout"].strip() or lic["stderr"].strip(),
115
+ "hardware_info": hd["stdout"].strip(),
116
+ "pricing_and_portal": "https://pykevlar.com/#pricing | https://pykevlar.com/portal",
117
+ },
118
+ indent=2,
119
+ )
120
+
121
+ if name == "bundle_python_free":
122
+ entry = str(arguments["entry_script"])
123
+ out_dir = str(arguments.get("output_dir") or "dist")
124
+ cmd = ["build", entry, "--no-armor", "-O", out_dir]
125
+ if arguments.get("onefile", True):
126
+ cmd.append("-F")
127
+ res = _call_cli(cmd)
128
+ return res["exit_code"] != 0, json.dumps(res, indent=2)
129
+
130
+ if name == "build_protected_release":
131
+ entry = str(arguments["entry_script"])
132
+ out_dir = str(arguments.get("output_dir") or "dist")
133
+ cmd = ["build", entry, "--mix-str", "-F", "-O", out_dir]
134
+ for pkg in arguments.get("protect_packages") or []:
135
+ cmd.extend(["--protect", str(pkg)])
136
+ if arguments.get("enable_bcc", True):
137
+ cmd.append("--enable-bcc")
138
+ if arguments.get("anti_llm", True):
139
+ cmd.append("--anti-llm")
140
+ if arguments.get("outer_rkey", False):
141
+ cmd.append("--outer")
142
+ if arguments.get("target_linux"):
143
+ cmd.extend(["--target", str(arguments["target_linux"])])
144
+ res = _call_cli(cmd)
145
+ if res["exit_code"] != 0 and ("subscription" in res["stderr"].lower() or "license" in res["stderr"].lower()):
146
+ res["upgrade_instructions"] = (
147
+ "Anti-reverse-engineering requires an active PyKevlar Pro ($39/yr) or Team ($79/yr) license. "
148
+ "Purchase instantly at https://pykevlar.com/#pricing and run `pykevlar register <PKA1_CODE>`."
149
+ )
150
+ return res["exit_code"] != 0, json.dumps(res, indent=2)
151
+
152
+ return True, f"Unknown tool: {name}"
153
+
154
+
155
+ def _reply(req_id, result: dict) -> None:
156
+ msg = {"jsonrpc": "2.0", "id": req_id, "result": result}
157
+ sys.stdout.write(json.dumps(msg) + "\n")
158
+ sys.stdout.flush()
159
+
160
+
161
+ def main() -> int:
162
+ for raw_line in sys.stdin:
163
+ line = raw_line.strip()
164
+ if not line:
165
+ continue
166
+ try:
167
+ req = json.loads(line)
168
+ except Exception:
169
+ continue
170
+
171
+ method = req.get("method", "")
172
+ req_id = req.get("id")
173
+ params = req.get("params") or {}
174
+
175
+ if method == "initialize":
176
+ _reply(
177
+ req_id,
178
+ {
179
+ "protocolVersion": "2024-11-05",
180
+ "capabilities": {"tools": {}},
181
+ "serverInfo": {"name": "pykevlar-mcp", "version": __version__},
182
+ },
183
+ )
184
+ elif method == "notifications/initialized":
185
+ continue
186
+ elif method == "ping":
187
+ _reply(req_id, {})
188
+ elif method == "tools/list":
189
+ _reply(req_id, {"tools": TOOLS})
190
+ elif method == "tools/call":
191
+ is_err, text = _handle_tool_call(str(params.get("name") or ""), params.get("arguments") or {})
192
+ _reply(req_id, {"content": [{"type": "text", "text": text}], "isError": is_err})
193
+ elif req_id is not None:
194
+ msg = {"jsonrpc": "2.0", "id": req_id, "error": {"code": -32601, "message": f"Method not found: {method}"}}
195
+ sys.stdout.write(json.dumps(msg) + "\n")
196
+ sys.stdout.flush()
197
+ return 0
198
+
199
+
200
+ if __name__ == "__main__":
201
+ raise SystemExit(main())
@@ -0,0 +1,126 @@
1
+ Metadata-Version: 2.4
2
+ Name: pykevlar
3
+ Version: 2.0.3
4
+ Summary: 28.8x faster Python obfuscator, Anti-LLM/anti-decompiler shield (stops pyinstxtractor, PyLingual, pycdc, GhidraMCP & Frida), MCP server for Claude Code/Cursor, hardware licenser, and single-binary compiler.
5
+ Author-email: PyKevlar Labs <licenses@pykevlar.com>
6
+ License-Expression: LicenseRef-PyKevlar
7
+ Project-URL: Homepage, https://pykevlar.com/
8
+ Project-URL: Repository, https://github.com/pykevlar/pykevlar
9
+ Project-URL: Bug Tracker, https://github.com/pykevlar/pykevlar/issues
10
+ Project-URL: Free Exposure Scanner, https://pykevlar.com/scanner
11
+ Project-URL: Documentation, https://pykevlar.com/docs
12
+ Project-URL: PyArmor vs PyKevlar, https://pykevlar.com/pyarmor-alternative
13
+ Project-URL: Anti-RE Threat Matrix, https://pykevlar.com/security
14
+ Project-URL: Claude Code & MCP Server, https://pykevlar.com/agents
15
+ Project-URL: License Portal, https://pykevlar.com/portal
16
+ Project-URL: Engineering Blog, https://pykevlar.com/blog
17
+ Keywords: python-obfuscator,pyarmor,pyarmor-alternative,pyinstaller,nuitka,cython,anti-reverse-engineering,anti-decompiler,pyinstxtractor,pylingual,bytecode-encryption,hardware-licensing,standalone-binary,code-protection,anti-debugging,mcp,mcp-server,claude-code
18
+ Classifier: Development Status :: 5 - Production/Stable
19
+ Classifier: Environment :: Console
20
+ Classifier: Intended Audience :: Developers
21
+ Classifier: Operating System :: MacOS :: MacOS X
22
+ Classifier: Operating System :: POSIX :: Linux
23
+ Classifier: Programming Language :: C
24
+ Classifier: Programming Language :: Python :: 3
25
+ Classifier: Programming Language :: Python :: 3.10
26
+ Classifier: Programming Language :: Python :: 3.11
27
+ Classifier: Programming Language :: Python :: 3.12
28
+ Classifier: Programming Language :: Python :: 3.13
29
+ Classifier: Programming Language :: Python :: 3.14
30
+ Classifier: Programming Language :: Rust
31
+ Classifier: Topic :: Security :: Cryptography
32
+ Classifier: Topic :: Software Development :: Build Tools
33
+ Classifier: Topic :: Software Development :: Compilers
34
+ Classifier: Topic :: System :: Software Distribution
35
+ Requires-Python: >=3.9
36
+ Description-Content-Type: text/markdown
37
+ License-File: LICENSE
38
+ Dynamic: license-file
39
+
40
+ # PyKevlar — Python Obfuscator, Anti-Decompiler & Single-Binary Compiler
41
+
42
+ <!-- mcp-name: io.github.pykevlar/pykevlar -->
43
+
44
+ **[Official Website](https://pykevlar.com/)** · **[GitHub & Action](https://github.com/pykevlar/pykevlar)** · **[Free Exposure Scanner](https://pykevlar.com/scanner)** · **[PyArmor Comparison & Benchmarks](https://pykevlar.com/pyarmor-alternative)** · **[Claude Code & MCP Server](https://pykevlar.com/agents)** · **[Production Docs](https://pykevlar.com/docs)**
45
+
46
+ **PyKevlar** (`pykevlar`) is a 15-core parallel Rust + Native C Python release compiler, hardware-locked licensing engine, and anti-reverse-engineering suite for **Python 3.12–3.14**.
47
+
48
+ Standard PyInstaller executables unpack in under five seconds using `pyinstxtractor` and neural decompilers like `PyLingual` or `pycdc`. PyKevlar replaces fragile two-step `PyArmor + PyInstaller` scripts with a **single native binary** that compiles **28.8× faster** (31.0s → **1.08s** cold build on 802 modules) with **zero runtime Python dependencies**.
49
+
50
+ ---
51
+
52
+ ## Install
53
+
54
+ ```bash
55
+ pip install pykevlar
56
+ # or via uv:
57
+ uv tool install pykevlar
58
+ ```
59
+
60
+ Audit any Python repository for decompiler & prompt-leak exposure in 50ms, or connect directly to **Claude Code / Cursor / Codex** via the built-in MCP server:
61
+
62
+ ```bash
63
+ # Scan your codebase for pyinstxtractor / PyLingual / `strings` exposure:
64
+ pykevlar audit .
65
+
66
+ # Register the official PyKevlar MCP server in Claude Code:
67
+ claude mcp add pykevlar -- pykevlar-mcp
68
+ ```
69
+
70
+ ---
71
+
72
+ ## How PyKevlar Stops Modern Python Reverse Engineering
73
+
74
+ | Reverse-Engineering Tool / Attack Vector | Plain PyInstaller | PyKevlar (Pro & Team) |
75
+ |---|---|---|
76
+ | **`pyinstxtractor` / `binwalk` archive extraction** | Extracts all `.pyc` files in ~2s | **Blocked** — `SPZ2` stream-encrypted container eliminates `MEI` & `zlib` magic headers |
77
+ | **`PyLingual` / `pycdc` / `uncompyle6` bytecode decompilers** | Recovers ~99% readable `.py` source | **Blocked** — per-function ChaCha20-Poly1305 Vectorcall Vaults; zero plaintext bytecode at rest |
78
+ | **`GhidraMCP` / `REA` / `IDA` autonomous LLM agents** | Summarizes symbols & C control flow | **Defeated** — `--anti-llm` CREAM AST identifier stripping, 64-bit MBA predicates & crypto honey-keys |
79
+ | **`Frida` / `sys.settrace` / Python 3.12+ PEP 669 `sys.monitoring`** | Dumps decrypted frames at runtime | **Blocked** — C-level vectorcall dispatch & active PEP 669 / debugger / `LD_PRELOAD` traps |
80
+ | **Unlicensed server copying & expired on-prem trials** | Unlimited copy-paste execution | **Enforced** — 198-byte ChaCha20-Poly1305 `pyarmor.rkey` bound to hardware UUID & UTC expiry |
81
+
82
+ ---
83
+
84
+ ## Quickstart Commands
85
+
86
+ ### 1. Free Standalone Bundler (`Basic — $0`)
87
+ Use PyKevlar as an ultra-fast single-binary replacement for `PyInstaller` (plain packaging without code obfuscation):
88
+
89
+ ```bash
90
+ pykevlar build main.py --no-armor -F -O dist
91
+ ```
92
+
93
+ ### 2. Full Anti-Reverse-Engineering + Native C Compilation (`Pro — $39/yr` · `Team — $79/yr`)
94
+ Activate your multi-device subscription key once (works offline on flights & air-gapped networks via Ed25519 signatures):
95
+
96
+ ```bash
97
+ pykevlar register "PKA1-..."
98
+
99
+ # Seal Python modules inside ChaCha20 vaults + transpile hot functions to stripped C + Anti-LLM stealth:
100
+ pykevlar build main.py \
101
+ --protect apps \
102
+ --enable-bcc \
103
+ --anti-llm \
104
+ --outer \
105
+ -F -O dist
106
+
107
+ # Mint a per-customer hardware-bound, 365-day runtime key in 6ms (zero binary rebuilds):
108
+ pykevlar key -O dist -b spa-dev-a7256ca34bcac081 -e +365d
109
+ ```
110
+
111
+ ### 3. Zero-Docker macOS → Linux Cross-Compilation (`Team — $79/yr`)
112
+ Compile production `linux-x86_64` or `linux-arm64` ELF64 single binaries directly from an Apple Silicon MacBook:
113
+
114
+ ```bash
115
+ pykevlar build main.py --target linux-x86_64 --enable-bcc --anti-llm -F -O dist-linux
116
+ ```
117
+
118
+ ---
119
+
120
+ ## Plans & Licensing
121
+
122
+ - **Basic ($0 Free)**: Unprotected standalone binary bundling (`--no-armor`), `audit`, `pykevlar-mcp`, `bench`, `hdinfo`, `cache`, `verify`. *(All anti-reverse-engineering & code obfuscation features require an active Pro or Team subscription.)*
123
+ - **Pro ($39/yr — $29.25/yr Year 1 w/ code `LAUNCH25`)**: Full 7-layer anti-reverse-engineering, ChaCha20 vaults, `--enable-bcc` C transpiler, `--anti-llm`, customer `--outer` hardware/expiry `rkey` licensing, and **3 developer build devices** (14-day compatibility money-back guarantee).
124
+ - **Team ($79/yr — $59.25/yr Year 1 w/ code `LAUNCH25`)**: Everything in Pro + **25 build devices**, unlimited CI/CD & Docker runners (`PYKEVLAR_LICENSE` + `uses: pykevlar/pykevlar@v2`), zero-Docker macOS → Linux cross-compilation, and 15-core Next.js chunk obfuscation (`pykevlar frontend`).
125
+
126
+ Learn more and get started at **[https://pykevlar.com](https://pykevlar.com/)**.
@@ -0,0 +1,11 @@
1
+ pykevlar/__init__.py,sha256=OHU1Amp74aCBs3Fv6WPq2J7ZE2ikw_vtArF1x2Ws_xI,211
2
+ pykevlar/__main__.py,sha256=Uopa9kP0x57Hia6OojVeeTX1C4MHsuXr-cYNLOoBFdE,80
3
+ pykevlar/_cli.py,sha256=1g5lxs1vhc14Kdrvb5v6TDu_DRgisyDs4ZI-BHbmttU,3510
4
+ pykevlar/auditor.py,sha256=0FFEx5pkmL8wHCkAFOmg9YisgRlLsgxAM-bRLedEDyA,8535
5
+ pykevlar/mcp_server.py,sha256=mokj5e0x8HyNSB4LU6MKwKldzJj1wlF3gmfVzprvJBo,7987
6
+ pykevlar-2.0.3.dist-info/licenses/LICENSE,sha256=72zbpiO8vnLVtv93DfZtwBTu0QTfTIID9BcyHiIKHrE,707
7
+ pykevlar-2.0.3.dist-info/METADATA,sha256=ZOMtkW8nAzDv9H8ICAP1I1Sywg3oLIB1kVz1zEhkw2Y,6919
8
+ pykevlar-2.0.3.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
9
+ pykevlar-2.0.3.dist-info/entry_points.txt,sha256=e0L6iHRg-zX53tm0eogvj-9DJcJuLUYpkJPgkznwqMY,88
10
+ pykevlar-2.0.3.dist-info/top_level.txt,sha256=dPrwXSA32sPh7m6melH6pxxd7sA58fPR6WlsNtGTrmM,9
11
+ pykevlar-2.0.3.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ pykevlar = pykevlar._cli:main
3
+ pykevlar-mcp = pykevlar.mcp_server:main
@@ -0,0 +1,12 @@
1
+ PyKevlar Software Distribution License
2
+ Copyright (c) 2026 PyKevlar Labs (https://pykevlar.com). All rights reserved.
3
+
4
+ Permission is hereby granted, free of charge, to install, redistribute, and use the
5
+ `pykevlar` CLI launcher package and its Basic (`--no-armor`) standalone Python bundler,
6
+ `bench`, `hdinfo`, `cache`, and `verify` commands for personal and commercial software builds.
7
+
8
+ Anti-reverse-engineering, bytecode encryption, native C transpilation (`--enable-bcc`),
9
+ Anti-LLM stealth (`--anti-llm`), and customer runtime key generation require an active
10
+ PyKevlar Pro or Team subscription from https://pykevlar.com.
11
+
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED.
@@ -0,0 +1 @@
1
+ pykevlar