Skip to content

Commit a616e2c

Browse files
committed
feat(rust+python): expose native crypto helpers, integrate Python package, fix PE builder alignment, add tests, and configure maturin
1 parent d4bb1fc commit a616e2c

File tree

3,765 files changed

+52844
-96
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,765 files changed

+52844
-96
lines changed

Cargo.lock

Lines changed: 1191 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,35 +22,23 @@ path = "src/bin/main.rs"
2222
goblin = "0.6"
2323
rand = "0.8"
2424
aes = "0.8"
25-
block-modes = "0.9"
25+
cbc = "0.1"
2626
sha2 = "0.10"
2727
serde = { version = "1.0", features = ["derive"] }
2828
serde_json = "1.0"
2929
tempfile = "3.6"
3030
log = "0.4"
3131
anyhow = "1.0"
32+
thiserror = "1.0"
33+
env_logger = "0.11"
34+
chrono = { version = "0.4", default-features = false, features = ["clock"] }
35+
hex = "0.4"
3236

3337
# Python bindings
34-
pyo3 = { version = "0.20", features = ["extension-module", "abi3-py38"] }
35-
numpy = { version = "0.19", optional = true }
38+
pyo3 = { version = "0.20", features = ["extension-module", "abi3-py38"], optional = true }
39+
numpy = { version = "0.20", optional = true }
3640

3741
[features]
3842
default = []
3943
python = ["pyo3", "numpy"]
40-
cli = []
41-
42-
[package.metadata.maturin]
43-
classifier = [
44-
"Development Status :: 4 - Beta",
45-
"Intended Audience :: Education",
46-
"Intended Audience :: Science/Research",
47-
"License :: OSI Approved :: MIT License",
48-
"License :: OSI Approved :: Apache Software License",
49-
"Programming Language :: Rust",
50-
"Programming Language :: Python :: Implementation :: CPython",
51-
"Topic :: Security",
52-
"Topic :: Software Development :: Libraries",
53-
]
54-
55-
[package.metadata.maturin.python]
56-
requires-python = ">=3.8"
44+
cli = []

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ training = [
5252
pe-packer = "pe_packer.cli:main"
5353

5454
[tool.maturin]
55-
features = ["pyo3"]
55+
features = ["python"]
5656
module-name = "pe_packer._native"
57+
python-source = "python"
58+
packages = ["pe_packer"]
5759

5860
# Python tool configurations
5961
[tool.black]
698 Bytes
Binary file not shown.
6.83 KB
Binary file not shown.

python/pe_packer/_native.abi3.so

779 KB
Binary file not shown.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from typing import Optional, Union
77
from pathlib import Path
88
import json
9+
from .utils import crypto as _crypto
910

1011

1112
class EncryptionAlgorithm(Enum):
@@ -70,6 +71,13 @@ def __init__(self, config: PackerConfig):
7071
Args:
7172
config: PackerConfig instance with packing parameters
7273
"""
74+
# Ensure key is present using native-backed helpers when needed
75+
if config.key is None:
76+
if config.encryption == EncryptionAlgorithm.XOR:
77+
config.key = _crypto.generate_xor_key(32)
78+
elif config.encryption == EncryptionAlgorithm.AES:
79+
config.key = _crypto.generate_aes_key()
80+
7381
self.config = config
7482
# Import native Rust binding
7583
try:

0 commit comments

Comments
 (0)