PyProtect-v3 3.2.0__tar.gz → 3.2.2__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.
- {pyprotect_v3-3.2.0 → pyprotect_v3-3.2.2}/PKG-INFO +1 -1
- {pyprotect_v3-3.2.0 → pyprotect_v3-3.2.2}/PyProtect_v3.egg-info/PKG-INFO +1 -1
- {pyprotect_v3-3.2.0 → pyprotect_v3-3.2.2}/PyProtect_v3.egg-info/SOURCES.txt +1 -0
- {pyprotect_v3-3.2.0 → pyprotect_v3-3.2.2}/pyproject.toml +4 -1
- pyprotect_v3-3.2.2/pyprotect/_version.py +1 -0
- {pyprotect_v3-3.2.0 → pyprotect_v3-3.2.2}/pyprotect/engine.c +12 -2
- {pyprotect_v3-3.2.0 → pyprotect_v3-3.2.2}/pyprotect/obfuscator.py +3 -18
- {pyprotect_v3-3.2.0 → pyprotect_v3-3.2.2}/MANIFEST.in +0 -0
- {pyprotect_v3-3.2.0 → pyprotect_v3-3.2.2}/PyProtect_v3.egg-info/dependency_links.txt +0 -0
- {pyprotect_v3-3.2.0 → pyprotect_v3-3.2.2}/PyProtect_v3.egg-info/entry_points.txt +0 -0
- {pyprotect_v3-3.2.0 → pyprotect_v3-3.2.2}/PyProtect_v3.egg-info/requires.txt +0 -0
- {pyprotect_v3-3.2.0 → pyprotect_v3-3.2.2}/PyProtect_v3.egg-info/top_level.txt +0 -0
- {pyprotect_v3-3.2.0 → pyprotect_v3-3.2.2}/README.md +0 -0
- {pyprotect_v3-3.2.0 → pyprotect_v3-3.2.2}/pyprotect/__init__.py +0 -0
- {pyprotect_v3-3.2.0 → pyprotect_v3-3.2.2}/pyprotect/__main__.py +0 -0
- {pyprotect_v3-3.2.0 → pyprotect_v3-3.2.2}/pyprotect/anti_debug.py +0 -0
- {pyprotect_v3-3.2.0 → pyprotect_v3-3.2.2}/pyprotect/crypto.py +0 -0
- {pyprotect_v3-3.2.0 → pyprotect_v3-3.2.2}/pyprotect/engine.py +0 -0
- {pyprotect_v3-3.2.0 → pyprotect_v3-3.2.2}/pyprotect/hooks.py +0 -0
- {pyprotect_v3-3.2.0 → pyprotect_v3-3.2.2}/setup.cfg +0 -0
- {pyprotect_v3-3.2.0 → pyprotect_v3-3.2.2}/setup.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "PyProtect-v3"
|
|
7
|
-
|
|
7
|
+
dynamic = ["version"]
|
|
8
8
|
description = "Python script obfuscation library with AES-256-GCM encryption and C extension acceleration"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.8"
|
|
@@ -41,6 +41,9 @@ pyprotect = "pyprotect.__main__:main"
|
|
|
41
41
|
dev = ["pytest>=7.0", "pytest-cov>=4.0"]
|
|
42
42
|
build = ["wheel>=0.27.0", "build>=0.7.0"]
|
|
43
43
|
|
|
44
|
+
[tool.setuptools.dynamic]
|
|
45
|
+
version = {attr = "pyprotect._version.__version__"}
|
|
46
|
+
|
|
44
47
|
[tool.setuptools.packages.find]
|
|
45
48
|
include = ["pyprotect*"]
|
|
46
49
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "3.2.2"
|
|
@@ -44,6 +44,11 @@
|
|
|
44
44
|
#include <openssl/err.h>
|
|
45
45
|
#endif
|
|
46
46
|
|
|
47
|
+
/* Suppress unused-parameter warnings for standard module functions */
|
|
48
|
+
#ifdef __GNUC__
|
|
49
|
+
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
|
50
|
+
#endif
|
|
51
|
+
|
|
47
52
|
#include <zlib.h>
|
|
48
53
|
|
|
49
54
|
/* Constants */
|
|
@@ -65,9 +70,11 @@ static const unsigned char EMBEDDED_KEY[32] = {
|
|
|
65
70
|
|
|
66
71
|
/* ------------------------------------------------------------------ */
|
|
67
72
|
/* Embedded AES-256-GCM implementation (public domain) */
|
|
68
|
-
/*
|
|
73
|
+
/* Only compiled when OpenSSL is not available */
|
|
69
74
|
/* ------------------------------------------------------------------ */
|
|
70
75
|
|
|
76
|
+
#if defined(USE_EMBEDDED_AES)
|
|
77
|
+
|
|
71
78
|
static const uint8_t aes_sbox[256] = {
|
|
72
79
|
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
|
|
73
80
|
0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,
|
|
@@ -252,6 +259,8 @@ static int aes_gcm_decrypt(const uint8_t *key, int key_len,
|
|
|
252
259
|
return (int)ct_len;
|
|
253
260
|
}
|
|
254
261
|
|
|
262
|
+
#endif /* USE_EMBEDDED_AES */
|
|
263
|
+
|
|
255
264
|
/* ------------------------------------------------------------------ */
|
|
256
265
|
/* Anti-debug */
|
|
257
266
|
/* ------------------------------------------------------------------ */
|
|
@@ -798,7 +807,8 @@ static PyMethodDef EngineMethods[] = {
|
|
|
798
807
|
static struct PyModuleDef enginemodule = {
|
|
799
808
|
PyModuleDef_HEAD_INIT, "engine_c",
|
|
800
809
|
"pyprotect-v4 engine - frame hook, anti-tamper, anti-dump",
|
|
801
|
-
-1, EngineMethods
|
|
810
|
+
-1, EngineMethods,
|
|
811
|
+
NULL, NULL, NULL, NULL
|
|
802
812
|
};
|
|
803
813
|
|
|
804
814
|
PyMODINIT_FUNC PyInit_engine_c(void) {
|
|
@@ -10,11 +10,11 @@ import marshal
|
|
|
10
10
|
import types
|
|
11
11
|
import random
|
|
12
12
|
import string
|
|
13
|
-
import shutil
|
|
14
13
|
import ast
|
|
15
14
|
import base64
|
|
16
15
|
|
|
17
16
|
from pyprotect.engine_c import encrypt
|
|
17
|
+
from pyprotect._version import __version__ as VERSION
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
BOOTSTRAP_TEMPLATE = '''# PyProtect-v3 | github.com/PyProtect/PyProtect
|
|
@@ -375,7 +375,7 @@ class Obfuscator:
|
|
|
375
375
|
|
|
376
376
|
# Generate multi bootstrap
|
|
377
377
|
bootstrap_source = MULTI_BOOTSTRAP_TEMPLATE.format(
|
|
378
|
-
version=
|
|
378
|
+
version=VERSION,
|
|
379
379
|
modules=modules,
|
|
380
380
|
)
|
|
381
381
|
|
|
@@ -391,9 +391,6 @@ class Obfuscator:
|
|
|
391
391
|
with open(out_path, "w", encoding="utf-8") as f:
|
|
392
392
|
f.write(bootstrap_source)
|
|
393
393
|
|
|
394
|
-
# Copy engine if available
|
|
395
|
-
self._copy_engine(output_dir)
|
|
396
|
-
|
|
397
394
|
print(f"[+] Generated multi-module bootstrap: {out_path}")
|
|
398
395
|
print(f"[!] Run: python {out_path}")
|
|
399
396
|
print(f"[!] Or import it from another script")
|
|
@@ -412,7 +409,7 @@ class Obfuscator:
|
|
|
412
409
|
stub_source = _generate_polymorphic_stub(repr(encrypted))
|
|
413
410
|
else:
|
|
414
411
|
stub_source = BOOTSTRAP_TEMPLATE.format(
|
|
415
|
-
version=
|
|
412
|
+
version=VERSION,
|
|
416
413
|
payload=encrypted,
|
|
417
414
|
)
|
|
418
415
|
|
|
@@ -425,15 +422,3 @@ class Obfuscator:
|
|
|
425
422
|
os.chmod(stub_path, 0o755)
|
|
426
423
|
|
|
427
424
|
return stub_path
|
|
428
|
-
|
|
429
|
-
def _copy_engine(self, output_dir: str):
|
|
430
|
-
"""Copy compiled C extension next to output if available."""
|
|
431
|
-
engine_dir = os.path.dirname(os.path.abspath(__file__))
|
|
432
|
-
for fname in os.listdir(engine_dir):
|
|
433
|
-
if fname.startswith("engine_c") and (
|
|
434
|
-
fname.endswith(".so") or fname.endswith(".pyd") or fname.endswith(".dll")
|
|
435
|
-
):
|
|
436
|
-
try:
|
|
437
|
-
shutil.copy2(os.path.join(engine_dir, fname), os.path.join(output_dir, fname))
|
|
438
|
-
except (shutil.Error, OSError):
|
|
439
|
-
pass
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|