sitrtech 1.2.3__tar.gz → 1.2.4__tar.gz
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.
- {sitrtech-1.2.3 → sitrtech-1.2.4}/PKG-INFO +1 -1
- {sitrtech-1.2.3 → sitrtech-1.2.4}/pyproject.toml +1 -1
- {sitrtech-1.2.3 → sitrtech-1.2.4}/src/sitrtech/__init__.py +1 -1
- {sitrtech-1.2.3 → sitrtech-1.2.4}/src/sitrtech/cli.py +27 -4
- {sitrtech-1.2.3 → sitrtech-1.2.4}/src/sitrtech/local.py +26 -4
- {sitrtech-1.2.3 → sitrtech-1.2.4}/src/sitrtech.egg-info/PKG-INFO +1 -1
- {sitrtech-1.2.3 → sitrtech-1.2.4}/README.md +0 -0
- {sitrtech-1.2.3 → sitrtech-1.2.4}/setup.cfg +0 -0
- {sitrtech-1.2.3 → sitrtech-1.2.4}/src/sitrtech/engine.py +0 -0
- {sitrtech-1.2.3 → sitrtech-1.2.4}/src/sitrtech/php.py +0 -0
- {sitrtech-1.2.3 → sitrtech-1.2.4}/src/sitrtech/runtime.py +0 -0
- {sitrtech-1.2.3 → sitrtech-1.2.4}/src/sitrtech.egg-info/SOURCES.txt +0 -0
- {sitrtech-1.2.3 → sitrtech-1.2.4}/src/sitrtech.egg-info/dependency_links.txt +0 -0
- {sitrtech-1.2.3 → sitrtech-1.2.4}/src/sitrtech.egg-info/entry_points.txt +0 -0
- {sitrtech-1.2.3 → sitrtech-1.2.4}/src/sitrtech.egg-info/requires.txt +0 -0
- {sitrtech-1.2.3 → sitrtech-1.2.4}/src/sitrtech.egg-info/top_level.txt +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "sitrtech"
|
|
7
|
-
version = "1.2.
|
|
7
|
+
version = "1.2.4"
|
|
8
8
|
description = "SitrTech Python code encryption CLI — protect Odoo, Django, Flask, FastAPI and Tornado projects"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "Proprietary" }
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"""
|
|
2
|
-
sitrtech — Python code encryption CLI v1.
|
|
2
|
+
sitrtech — Python code encryption CLI v1.2.4
|
|
3
3
|
==============================================
|
|
4
4
|
|
|
5
|
-
Encrypt Odoo, Django, Flask, FastAPI and
|
|
5
|
+
Encrypt Odoo, Frappe, Django, Flask, FastAPI, Tornado (and WordPress, Laravel, PHP) projects with AES-256-GCM
|
|
6
6
|
in a single command. Supports incremental updates, expiry dates, and IP-based
|
|
7
7
|
network restrictions.
|
|
8
8
|
|
|
@@ -44,7 +44,7 @@ from rich.table import Table
|
|
|
44
44
|
# Constants
|
|
45
45
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
46
46
|
|
|
47
|
-
__version__ = "1.2.
|
|
47
|
+
__version__ = "1.2.4"
|
|
48
48
|
API_BASE_DEFAULT = "https://sitrtech.com"
|
|
49
49
|
MANIFEST_SUFFIX = ".sitr_manifest.json"
|
|
50
50
|
|
|
@@ -434,6 +434,26 @@ def encrypt(
|
|
|
434
434
|
f"[dim]{e}[/]")
|
|
435
435
|
sys.exit(1)
|
|
436
436
|
console.print("[dim]Local mode — your source never leaves this machine.[/]")
|
|
437
|
+
|
|
438
|
+
# Incremental: meter only the files that changed since the last run. The
|
|
439
|
+
# whole project is still re-encrypted (free, local CPU) so a single job
|
|
440
|
+
# key keeps every file decryptable — you just pay for what changed.
|
|
441
|
+
current_checksums = _get_checksums(file)
|
|
442
|
+
manifest = _load_manifest(output_path)
|
|
443
|
+
bill_members: Optional[set] = None
|
|
444
|
+
if not full and manifest is not None and output_path.exists():
|
|
445
|
+
prev = (manifest or {}).get("files", {})
|
|
446
|
+
changed = {n for n, h in current_checksums.items() if prev.get(n) != h}
|
|
447
|
+
if not changed:
|
|
448
|
+
console.print("\n[green]✓ No changes detected.[/] Output is already up to date.")
|
|
449
|
+
return
|
|
450
|
+
console.print("[dim]▸ Manifest found — incremental mode[/]")
|
|
451
|
+
console.print(f"[bold cyan]Incremental:[/] {len(changed)} file(s) changed")
|
|
452
|
+
for n in sorted(changed):
|
|
453
|
+
tag = "[green]+new[/]" if n not in prev else "[yellow]~mod[/]"
|
|
454
|
+
console.print(f" {tag} {n}")
|
|
455
|
+
bill_members = changed
|
|
456
|
+
|
|
437
457
|
with Progress(SpinnerColumn(), TextColumn("[progress.description]{task.description}"),
|
|
438
458
|
BarColumn(bar_width=30), TimeElapsedColumn(),
|
|
439
459
|
console=console, transient=True) as prog:
|
|
@@ -445,7 +465,8 @@ def encrypt(
|
|
|
445
465
|
try:
|
|
446
466
|
res = _local.encrypt_local(
|
|
447
467
|
str(file), str(output_path), fw, base, resolved_secret,
|
|
448
|
-
protection=protection, version=version,
|
|
468
|
+
protection=protection, version=version,
|
|
469
|
+
bill_members=bill_members, on_status=_status,
|
|
449
470
|
)
|
|
450
471
|
except _local.LocalError as e:
|
|
451
472
|
err_console.print(f"[red]Error:[/] {e}")
|
|
@@ -458,6 +479,8 @@ def encrypt(
|
|
|
458
479
|
f"{res.get('tokens_left', '?'):,} left[/]")
|
|
459
480
|
if res.get("protection"):
|
|
460
481
|
console.print("[dim]Binding rules embedded (license enforced at runtime).[/]")
|
|
482
|
+
mp = _save_manifest(output_path, fw, current_checksums)
|
|
483
|
+
console.print(f"[dim]Manifest: {mp.name} — next run is incremental.[/]")
|
|
461
484
|
console.print()
|
|
462
485
|
return
|
|
463
486
|
|
|
@@ -300,9 +300,16 @@ def encrypt_local(
|
|
|
300
300
|
protection: Optional[Dict[str, Any]] = None,
|
|
301
301
|
version: str = "",
|
|
302
302
|
loaders_dir: Optional[str] = None,
|
|
303
|
+
bill_members: Optional[set] = None,
|
|
303
304
|
on_status=None,
|
|
304
305
|
) -> Dict[str, Any]:
|
|
305
|
-
"""Encrypt `zip_path` locally; contact `base_url` only to authorize + meter.
|
|
306
|
+
"""Encrypt `zip_path` locally; contact `base_url` only to authorize + meter.
|
|
307
|
+
|
|
308
|
+
Incremental billing: when `bill_members` is given (the set of changed source
|
|
309
|
+
files, relative to the zip root), only those lines are authorized and charged.
|
|
310
|
+
The whole project is still re-encrypted locally — that is free CPU and keeps a
|
|
311
|
+
single per-job key so every file decrypts — but you only pay for what changed.
|
|
312
|
+
"""
|
|
306
313
|
framework = (framework or "odoo").lower()
|
|
307
314
|
protection = protection or {}
|
|
308
315
|
say = on_status or (lambda *_: None)
|
|
@@ -328,6 +335,21 @@ def encrypt_local(
|
|
|
328
335
|
if est_lines <= 0:
|
|
329
336
|
raise LocalError("No encryptable Python files found.")
|
|
330
337
|
|
|
338
|
+
# Incremental: meter only the changed encryptable files.
|
|
339
|
+
if bill_members is not None:
|
|
340
|
+
skip = engine.FRAMEWORK_SKIP_ENCRYPT.get(framework, set())
|
|
341
|
+
changed_lines = 0
|
|
342
|
+
for m in bill_members:
|
|
343
|
+
if not m.endswith(".py") or os.path.basename(m) in skip:
|
|
344
|
+
continue
|
|
345
|
+
fp = os.path.join(extract, m)
|
|
346
|
+
if os.path.isfile(fp):
|
|
347
|
+
with open(fp, "r", encoding="utf-8", errors="ignore") as f:
|
|
348
|
+
changed_lines += sum(1 for _ in f)
|
|
349
|
+
bill_lines = max(1, changed_lines)
|
|
350
|
+
else:
|
|
351
|
+
bill_lines = est_lines
|
|
352
|
+
|
|
331
353
|
# 2) authorize online; if the platform is unreachable, fall back to a
|
|
332
354
|
# cached signed offline grant so encryption never stops.
|
|
333
355
|
say("authorize")
|
|
@@ -337,7 +359,7 @@ def encrypt_local(
|
|
|
337
359
|
try:
|
|
338
360
|
r = _post_signed(
|
|
339
361
|
base_url, "/api/authorize", secret,
|
|
340
|
-
{"framework": framework, "version": version, "est_lines":
|
|
362
|
+
{"framework": framework, "version": version, "est_lines": bill_lines,
|
|
341
363
|
"client_pub": client_pub},
|
|
342
364
|
)
|
|
343
365
|
if r.status_code == 401:
|
|
@@ -360,7 +382,7 @@ def encrypt_local(
|
|
|
360
382
|
"Platform unreachable and no offline grant cached. "
|
|
361
383
|
"While online run: sitr offline fetch")
|
|
362
384
|
say("offline")
|
|
363
|
-
job_kek, wrapped = _offline_acquire(cache,
|
|
385
|
+
job_kek, wrapped = _offline_acquire(cache, bill_lines)
|
|
364
386
|
offline = True
|
|
365
387
|
|
|
366
388
|
try:
|
|
@@ -389,7 +411,7 @@ def encrypt_local(
|
|
|
389
411
|
say("commit")
|
|
390
412
|
c = _post_signed(
|
|
391
413
|
base_url, "/api/commit", secret,
|
|
392
|
-
{"job_id": job_id, "actual_lines":
|
|
414
|
+
{"job_id": job_id, "actual_lines": bill_lines,
|
|
393
415
|
"module_name": os.path.basename(zip_path), "framework": framework,
|
|
394
416
|
"version": version, "modules": stats.get("files")},
|
|
395
417
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|