|
| 1 | +# Changelog |
| 2 | + |
| 3 | +All notable changes to this project will be documented in this file. |
| 4 | + |
| 5 | +The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). |
| 6 | +This project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). |
| 7 | + |
| 8 | +--- |
| 9 | + |
| 10 | +## [0.1.0] — AST-Based Rewrite |
| 11 | + |
| 12 | +Complete rewrite from a regex-based implementation to a fully AST-based pipeline. |
| 13 | + |
| 14 | +### Added |
| 15 | + |
| 16 | +- **`ObfuscationConfig`** — immutable frozen dataclass for selecting techniques. |
| 17 | + Factory methods: `all_enabled()`, `only(*names)`, `.without(*names)`, `.with_added(*names)`. |
| 18 | +- **Technique registry** — `@register` class decorator; techniques self-register by name. |
| 19 | + `all_technique_names()` and `get_transforms(enabled)` for pipeline construction. |
| 20 | +- **`variable_renamer`** — two-pass AST renamer. First pass collects renameable names |
| 21 | + (excludes builtins, imports, dunders, and attribute-accessed names); second pass applies |
| 22 | + the mapping. Also renames `nonlocal` and `global` statement name lists. |
| 23 | +- **`string_hex_encoder`** — converts string literals to `bytes.fromhex(…).decode('utf-8')` |
| 24 | + call nodes. Skips f-strings where replacing a `Constant` with a `Call` is invalid. |
| 25 | +- **`dead_code_injector`** — recursively injects dead variable assignments at every scope |
| 26 | + level: module body, function bodies, class bodies, if/for/while/try/with branches. |
| 27 | + Some assignments reference earlier dead variables (intra-scope cross-references) to |
| 28 | + simulate computation. Accepts `InjectionParams` and a seeded `random.Random` for |
| 29 | + reproducible output. |
| 30 | +- **`exec_wrapper`** — wraps the entire module in `exec(ast.unparse(tree))`, reducing the |
| 31 | + top-level AST to one statement. |
| 32 | +- **`Obfuscator` class** — caches the transform pipeline across multiple `obfuscate()` calls. |
| 33 | +- **`obfuscate()` module-level helper** — convenience wrapper for one-shot use. |
| 34 | +- **CLI** (`pyobfuscate`) — `--disable/-d` flag accepts technique names; `--stdout`; `--version/-V`. |
| 35 | +- **E2E test suite** with correctness and benchmark tests across six complex programs. |
| 36 | +- **Per-technique runtime benchmarks** showing individual overhead contribution. |
| 37 | +- 100 % branch coverage enforced in CI. |
| 38 | +- Python 3.10–3.14 test matrix. |
| 39 | + |
| 40 | +### Changed |
| 41 | + |
| 42 | +- Priority ordering now encoded in `TechniqueMetadata.priority` rather than list position. |
| 43 | +- `VariableNameGenerator` and `RandomDataTypeGenerator` accept an optional `rng` argument |
| 44 | + for deterministic testing. |
| 45 | +- `_NameCollector` exposes `all_bound_names` (assigned + imported + builtins) for use by |
| 46 | + the dead-code injector's exclusion set. |
| 47 | + |
| 48 | +### Removed |
| 49 | + |
| 50 | +- All regex-based technique implementations (`techniques.py`). |
| 51 | +- `regex` runtime dependency (was used only for the old hex-encoding approach). |
| 52 | +- `SourceTransform` base class and `source_transforms` package. |
| 53 | + |
| 54 | +### Fixed |
| 55 | + |
| 56 | +- `VariableRenamer` now updates `nonlocal` and `global` statement name lists, preventing |
| 57 | + `SyntaxError: no binding for nonlocal '…' found` after renaming. |
| 58 | +- `VariableRenamer` excludes attribute-accessed names from renaming to prevent |
| 59 | + `AttributeError` when calling methods by the original name after their definition is renamed. |
| 60 | +- `_interleave` preserves relative ordering of injected statements (sorted random slots) |
| 61 | + so intra-scope cross-references never appear before their definitions. |
| 62 | + |
| 63 | +--- |
| 64 | + |
| 65 | +## [0.0.2] — prior release |
| 66 | + |
| 67 | +Initial public release with regex-based obfuscation techniques. |
| 68 | + |
| 69 | +- `one_liner` — collapsed newlines into semicolons (superceded by `exec_wrapper`). |
| 70 | +- `variable_renamer` — regex-based name replacement. |
| 71 | +- `add_random_variables` — prepended/appended random assignments at module level. |
| 72 | +- `str_to_hex_bytes` — regex-based string-to-hex conversion. |
0 commit comments