fermentanyl 0.2.0__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.
- fermentanyl-0.2.0/.gitignore +31 -0
- fermentanyl-0.2.0/CHANGELOG.md +90 -0
- fermentanyl-0.2.0/CONTRIBUTING.md +72 -0
- fermentanyl-0.2.0/LICENSE +21 -0
- fermentanyl-0.2.0/PKG-INFO +691 -0
- fermentanyl-0.2.0/README.md +649 -0
- fermentanyl-0.2.0/SECURITY.md +32 -0
- fermentanyl-0.2.0/docs/aes.md +124 -0
- fermentanyl-0.2.0/docs/backends.md +81 -0
- fermentanyl-0.2.0/docs/classical.md +110 -0
- fermentanyl-0.2.0/docs/cli.md +75 -0
- fermentanyl-0.2.0/docs/decoders.md +91 -0
- fermentanyl-0.2.0/docs/dh.md +47 -0
- fermentanyl-0.2.0/docs/ecc.md +93 -0
- fermentanyl-0.2.0/docs/extract.md +59 -0
- fermentanyl-0.2.0/docs/flags.md +51 -0
- fermentanyl-0.2.0/docs/hashes.md +72 -0
- fermentanyl-0.2.0/docs/index.md +46 -0
- fermentanyl-0.2.0/docs/numtheory.md +70 -0
- fermentanyl-0.2.0/docs/prng.md +52 -0
- fermentanyl-0.2.0/docs/registry.md +73 -0
- fermentanyl-0.2.0/docs/releasing.md +127 -0
- fermentanyl-0.2.0/docs/results.md +65 -0
- fermentanyl-0.2.0/docs/rsa.md +103 -0
- fermentanyl-0.2.0/docs/solve.md +71 -0
- fermentanyl-0.2.0/docs/utils.md +53 -0
- fermentanyl-0.2.0/pyproject.toml +124 -0
- fermentanyl-0.2.0/scripts/release.py +262 -0
- fermentanyl-0.2.0/src/fermentanyl/__init__.py +60 -0
- fermentanyl-0.2.0/src/fermentanyl/aes.py +731 -0
- fermentanyl-0.2.0/src/fermentanyl/backends.py +460 -0
- fermentanyl-0.2.0/src/fermentanyl/classical.py +1156 -0
- fermentanyl-0.2.0/src/fermentanyl/cli.py +582 -0
- fermentanyl-0.2.0/src/fermentanyl/decoders.py +834 -0
- fermentanyl-0.2.0/src/fermentanyl/dh.py +158 -0
- fermentanyl-0.2.0/src/fermentanyl/ecc.py +715 -0
- fermentanyl-0.2.0/src/fermentanyl/errors.py +29 -0
- fermentanyl-0.2.0/src/fermentanyl/extract.py +328 -0
- fermentanyl-0.2.0/src/fermentanyl/flags.py +167 -0
- fermentanyl-0.2.0/src/fermentanyl/hashes.py +885 -0
- fermentanyl-0.2.0/src/fermentanyl/numtheory.py +460 -0
- fermentanyl-0.2.0/src/fermentanyl/prng.py +214 -0
- fermentanyl-0.2.0/src/fermentanyl/py.typed +0 -0
- fermentanyl-0.2.0/src/fermentanyl/registry.py +282 -0
- fermentanyl-0.2.0/src/fermentanyl/results.py +351 -0
- fermentanyl-0.2.0/src/fermentanyl/rsa.py +1131 -0
- fermentanyl-0.2.0/src/fermentanyl/solve.py +291 -0
- fermentanyl-0.2.0/src/fermentanyl/utils.py +693 -0
- fermentanyl-0.2.0/tests/test_aes.py +178 -0
- fermentanyl-0.2.0/tests/test_backends.py +262 -0
- fermentanyl-0.2.0/tests/test_classical.py +116 -0
- fermentanyl-0.2.0/tests/test_cli.py +109 -0
- fermentanyl-0.2.0/tests/test_decoders.py +126 -0
- fermentanyl-0.2.0/tests/test_dh.py +45 -0
- fermentanyl-0.2.0/tests/test_ecc.py +191 -0
- fermentanyl-0.2.0/tests/test_extract.py +76 -0
- fermentanyl-0.2.0/tests/test_flags.py +58 -0
- fermentanyl-0.2.0/tests/test_hashes.py +130 -0
- fermentanyl-0.2.0/tests/test_numtheory.py +116 -0
- fermentanyl-0.2.0/tests/test_package.py +79 -0
- fermentanyl-0.2.0/tests/test_prng.py +58 -0
- fermentanyl-0.2.0/tests/test_registry.py +173 -0
- fermentanyl-0.2.0/tests/test_release_script.py +94 -0
- fermentanyl-0.2.0/tests/test_results.py +199 -0
- fermentanyl-0.2.0/tests/test_rsa.py +248 -0
- fermentanyl-0.2.0/tests/test_solve.py +113 -0
- fermentanyl-0.2.0/tests/test_utils.py +109 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Byte-compiled / optimized files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# Build and packaging
|
|
7
|
+
build/
|
|
8
|
+
dist/
|
|
9
|
+
*.egg-info/
|
|
10
|
+
.eggs/
|
|
11
|
+
wheels/
|
|
12
|
+
sdist/
|
|
13
|
+
|
|
14
|
+
# Virtual environments
|
|
15
|
+
.venv/
|
|
16
|
+
venv/
|
|
17
|
+
env/
|
|
18
|
+
|
|
19
|
+
# Test and lint caches
|
|
20
|
+
.pytest_cache/
|
|
21
|
+
.ruff_cache/
|
|
22
|
+
.mypy_cache/
|
|
23
|
+
.coverage
|
|
24
|
+
.coverage.*
|
|
25
|
+
htmlcov/
|
|
26
|
+
|
|
27
|
+
# Editors and OS files
|
|
28
|
+
.DS_Store
|
|
29
|
+
.idea/
|
|
30
|
+
.vscode/
|
|
31
|
+
*.swp
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here. The format is based on
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and this project uses
|
|
5
|
+
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.2.0] - 2026-11-30
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- `scripts/release.py`: one-command release helper that runs the gate, bumps
|
|
14
|
+
`__version__`, updates `CHANGELOG.md`, tags the commit, pushes and creates
|
|
15
|
+
the GitHub release; `docs/releasing.md` documents PyPI trusted publishing,
|
|
16
|
+
the manual fallback and troubleshooting.
|
|
17
|
+
- `fermentanyl.results`: `Attempt` and `AttackResult` records with confidence,
|
|
18
|
+
elapsed time and failure reasons, plus a `Budget` that combines a global
|
|
19
|
+
deadline with a per-attack timeout.
|
|
20
|
+
- `fermentanyl.registry`: a declarative `Attack` catalogue (name, category,
|
|
21
|
+
inputs, cost, preconditions, optional dependencies, `needs_oracle`) seeded
|
|
22
|
+
with the five RSA attacks that already have known-answer tests, and
|
|
23
|
+
`find`/`select` filters for the solver.
|
|
24
|
+
- `fermentanyl.backends`: capability probing for `gmpy2`, `fpylll`,
|
|
25
|
+
`python-flint` and SageMath, `load()` with install hints, process-based
|
|
26
|
+
`run_with_timeout`/`map_parallel` that kill runaway workers, and a
|
|
27
|
+
`run_sage` subprocess bridge that passes numbers as argv instead of code.
|
|
28
|
+
- `AttackTimeout`, raised when an attack, budget or backend call runs out of
|
|
29
|
+
time.
|
|
30
|
+
- `fermentanyl.extract`: `parse_values` for `n = 0x...`-style text,
|
|
31
|
+
`extract_rsa` for JSON and Base64-wrapped JSON, PEM/DER key parsing, and
|
|
32
|
+
`extract`/`extract_file` triage that never raises on unparseable bytes.
|
|
33
|
+
- `fermentanyl.flags`: `find_flags`, `first_flag` and `has_flag` for
|
|
34
|
+
`flag{}`/`CTF{}`/event prefixes and custom regular expressions.
|
|
35
|
+
- `fermentanyl.cli`: the `ferm` console script with `ferm solve` and
|
|
36
|
+
`ferm rsa`, `--json`/`--verbose`/`--explain`, verified cheapest-first attack
|
|
37
|
+
sweeps, per-attack and global budgets, and process-parallel execution.
|
|
38
|
+
- `fermentanyl.decoders`: Base58/62/85/91, binary, octal, Morse, ROT47, HTML,
|
|
39
|
+
gzip/bzip2/zlib and uuencode decoders, plus `decode_candidates`,
|
|
40
|
+
`auto_decode`, `quadgram_score`, `shannon_entropy` and `text_score` ranking.
|
|
41
|
+
- `fermentanyl.solve`: `classify` ranks RSA, encoding, hash, ECC, symmetric,
|
|
42
|
+
PRNG, classical, text and raw inputs; `solve` now peels the new decoder
|
|
43
|
+
layers, stops on flags and reports the recovered flag in `details`.
|
|
44
|
+
- `fermentanyl.classical.auto_decode` now delegates to the extended decoder
|
|
45
|
+
chain while keeping its original signature and return value.
|
|
46
|
+
|
|
47
|
+
### Changed
|
|
48
|
+
|
|
49
|
+
- The `Publish` workflow verifies that the release tag matches the built
|
|
50
|
+
version, can be run manually with a tag, publishes PEP 740 attestations,
|
|
51
|
+
and refuses to cancel an upload already in progress.
|
|
52
|
+
|
|
53
|
+
## [0.1.0] - 2026-11-28
|
|
54
|
+
|
|
55
|
+
### Added
|
|
56
|
+
|
|
57
|
+
- `fermentanyl.utils`: forgiving int/bytes/hex conversions, XOR helpers,
|
|
58
|
+
repeating-key XOR breaking, block splitting, and English scoring.
|
|
59
|
+
- `fermentanyl.numtheory`: extended GCD, modular inverse, CRT with non-coprime
|
|
60
|
+
moduli, Tonelli-Shanks, integer roots, BSGS/Pollard-rho discrete logs, and
|
|
61
|
+
sympy-backed primality/factoring helpers.
|
|
62
|
+
- `fermentanyl.rsa`: PEM key loading, raw key wrappers, common-modulus and
|
|
63
|
+
Hastad broadcast attacks, small-e root, Wiener and Boneh-Durfee small-`d`
|
|
64
|
+
attacks, Fermat, Pollard p-1, Williams p+1, batch GCD, Franklin-Reiter, CRT
|
|
65
|
+
fault recovery, multi-prime factoring from `(n, e, d)`, Bleichenbacher, and
|
|
66
|
+
LSB-oracle attacks.
|
|
67
|
+
- `fermentanyl.aes`: PKCS#7 helpers, ECB/CBC/CTR/GCM wrappers, ECB detection,
|
|
68
|
+
CBC padding-oracle decryption, ECB byte-at-a-time recovery, CBC bit-flipping,
|
|
69
|
+
CTR/GCM nonce-reuse recovery, CTR forgery, and RC4.
|
|
70
|
+
- `fermentanyl.ecc`: short-Weierstrass curves, secp256k1 and P-256 parameters,
|
|
71
|
+
ECDSA signing/verification, nonce-reuse and known-nonce recovery, BSGS,
|
|
72
|
+
Pohlig-Hellman, singular-curve mapping, small-subgroup and invalid-curve
|
|
73
|
+
attacks.
|
|
74
|
+
- `fermentanyl.classical`: Caesar, Vigenere, substitution breaking, affine,
|
|
75
|
+
Atbash, rail fence, Playfair, Bacon, Base16/Base32/Base64/URL helpers, and
|
|
76
|
+
nested encoding detection.
|
|
77
|
+
- `fermentanyl.hashes`: hash identification, MD5/SHA-1/SHA-256/SHA-512 length
|
|
78
|
+
extension, CRC-32 forging, dictionary cracking, and brute-force cracking.
|
|
79
|
+
- `fermentanyl.prng`: LCG parameter recovery and MT19937 state cloning.
|
|
80
|
+
- `fermentanyl.dh`: Diffie-Hellman shared secrets, ElGamal, and small-subgroup
|
|
81
|
+
exponent recovery.
|
|
82
|
+
- `fermentanyl.solve`: heuristic auto-detection for RSA material, encodings,
|
|
83
|
+
hashes, Caesar shifts, single-byte XOR, and raw data.
|
|
84
|
+
- Type hints throughout and a `py.typed` marker.
|
|
85
|
+
- Per-module documentation under `docs/`, including a full README function
|
|
86
|
+
reference with signatures, return values, aliases, and failure behavior.
|
|
87
|
+
|
|
88
|
+
[Unreleased]: https://github.com/kiyowa-39/fermentanyl/compare/v0.2.0...HEAD
|
|
89
|
+
[0.2.0]: https://github.com/kiyowa-39/fermentanyl/compare/v0.1.0...v0.2.0
|
|
90
|
+
[0.1.0]: https://github.com/kiyowa-39/fermentanyl/releases/tag/v0.1.0
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Contributing to fermentanyl
|
|
2
|
+
|
|
3
|
+
Thanks for helping improve the toolkit. Bug reports, new attacks, better
|
|
4
|
+
docstrings, and additional tests are all welcome.
|
|
5
|
+
|
|
6
|
+
## Development setup
|
|
7
|
+
|
|
8
|
+
The project targets Python 3.10+ and uses a `src/` layout.
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
git clone https://github.com/kiyowa-39/fermentanyl.git
|
|
12
|
+
cd fermentanyl
|
|
13
|
+
python -m venv .venv
|
|
14
|
+
source .venv/bin/activate
|
|
15
|
+
python -m pip install -e ".[dev]"
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
If you use [uv](https://docs.astral.sh/uv/):
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
uv venv
|
|
22
|
+
uv pip install -e ".[dev]"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Checks
|
|
26
|
+
|
|
27
|
+
Run the same checks as CI before opening a pull request:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
ruff check src tests
|
|
31
|
+
ruff format --check src tests
|
|
32
|
+
pytest
|
|
33
|
+
pytest --doctest-modules src/fermentanyl
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The test suite must pass without optional dependencies installed. If you add a
|
|
37
|
+
feature that needs `gmpy2` or `fpylll`, keep a pure-Python or
|
|
38
|
+
`MissingDependencyError` path and test both branches where practical.
|
|
39
|
+
|
|
40
|
+
## Guidelines
|
|
41
|
+
|
|
42
|
+
- Every public function needs a docstring covering the concept, arguments,
|
|
43
|
+
return value, and a runnable example. Examples are checked by
|
|
44
|
+
`pytest --doctest-modules`.
|
|
45
|
+
- Attacks that need a live challenge take a plain Python callable. Do not
|
|
46
|
+
require a custom protocol class.
|
|
47
|
+
- Raise `AttackNotApplicable` when the input does not satisfy an attack's
|
|
48
|
+
preconditions. Do not return a silently wrong result.
|
|
49
|
+
- Raise `MissingDependencyError` with an install hint when an optional package
|
|
50
|
+
is required.
|
|
51
|
+
- Add tests for both successful attacks and expected failure modes.
|
|
52
|
+
- Keep the public API practical and the implementation readable. Prefer a
|
|
53
|
+
straightforward attack over an over-general framework.
|
|
54
|
+
|
|
55
|
+
## Documentation
|
|
56
|
+
|
|
57
|
+
Add or update the relevant page under `docs/` and the function table in
|
|
58
|
+
`README.md` when you add a public API. Keep examples copy-pasteable.
|
|
59
|
+
|
|
60
|
+
## Releasing
|
|
61
|
+
|
|
62
|
+
Releases are cut from `main` with one command:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
python scripts/release.py --bump patch
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The script runs the CI gate, builds and checks the artifacts, bumps
|
|
69
|
+
`__version__`, moves the changelog entries under a dated heading, tags the
|
|
70
|
+
commit, pushes, and creates the GitHub release that uploads to PyPI through
|
|
71
|
+
trusted publishing. See [`docs/releasing.md`](docs/releasing.md) for the
|
|
72
|
+
one-time PyPI setup, the manual fallback, and troubleshooting.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 fermentanyl contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|