cryptsmith
Crypto attack primitives and analysis toolkit for CTF players and security researchers. Zero dependencies, stdlib only.
Built for challenges like NSA Codebreakers style pcaps: custom protocols, hidden enrollment keys, obfuscated traffic.
What it does
- Classical ciphers — caesar bruteforce with english scoring, vigenere, atbash, affine
- XOR — single byte bruteforce, repeating key break via hamming distance keysize guessing
- RSA attacks — Wiener's attack, Hastad broadcast, common modulus, small exponent
- Analysis — shannon entropy, index of coincidence, chi squared english scoring, frequency analysis
- Encoding — layered auto decode for base64, hex, url encoding, with the decode chain reported
- Hash ID — identify hash algorithms by digest length and charset
- PCAP — pure python pcap reader, IPv4/TCP parsing, TCP stream reassembly, payload carving, token hunting
Install
pip install cryptsmith
Quick use
from cryptsmith import xor, rsa, pcap, analysis
# break single byte xor
for key, plaintext, score in xor.single_byte_xor_break(data)[:3]:
print(key, plaintext)
# wiener attack on weak rsa
d = rsa.wiener_attack(n, e)
# pull tcp streams out of a pcap and hunt 12 char alpha tokens
streams = pcap.reassemble_streams(pcap.PcapReader("capture.pcap"))
for s in streams:
for token in pcap.hunt_alpha_tokens(s.payload, length=12):
print(s.label, token)
Companion project
flaghunter builds on cryptsmith: point it at a challenge file or a pcap and it runs a full battery of attacks automatically and writes you a report.
License
MIT
Metadata
Release files for cryptsmith 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cryptsmith-0.1.0.tar.gz | 14.7 kB | Without provenance | Details for cryptsmith-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cryptsmith-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for cryptsmith-0.1.0-py3-none-any.whl |
Total release size: 28.4 kB
Release files / cryptsmith-0.1.0.tar.gz
| Download URL | cryptsmith-0.1.0.tar.gz |
|---|---|
| Size | 14.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d656b722e79b84f2576b6baab73c80fab0aabedfbf56c774a9a551997600ac76
|
|
BLAKE2b-256 checksum How to use checksums |
8e21f6cf6f46e3c971799e5d0e47149098df31c5ccbbbba4be3ffc919831a807
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / cryptsmith-0.1.0-py3-none-any.whl
| Download URL | cryptsmith-0.1.0-py3-none-any.whl |
|---|---|
| Size | 13.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cf1807ee290795e4a1a2476e9c0ad2d28a6aa7c0bee8b13d3c215c6aff3d241c
|
|
BLAKE2b-256 checksum How to use checksums |
c2f64031cd01d1aea641c16eb2110bac350d500b18f5d89e851cca5be13a0798
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for cryptsmith 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.