feat/tools/rexcrack #14
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/tools/rexcrack"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
feat: add
rexcrackdictionary-attack demo (multithreaded) + tests & docsThis PR introduces
rexcrack, a small, heavily-commented companion tool to RexCrypt for teaching how verification can be composed into a dictionary attack. It’s intentionally educational (not production hardening), and mirrors RexCrypt’s CLI/design philosophy.Summary
New binary:
bin/rexcrackPurpose: multithreaded dictionary attack demo using
crypt_r(3)(“stored hash as setting” verification).Validation: anchored regex checks for supported
crypt(5)formats; usescrypt_checksalt()when available. Legacy DES/bigcrypt accepted on purpose (teaching).Concurrency: pool of pthread workers; one
struct crypt_dataper thread; sharedfgetsunder mutex; overlong line drain so the next candidate isn’t polluted.I/O discipline: winner printed on stdout; verbose logs (if enabled) go to stderr.
Exit codes:
0→ match found2→ not foundEX_*from<sysexits.h>(e.g.,EX_NOINPUTbad file,EX_DATAERRinvalid hash)Also included:
rexcrack; tests depend on both binaries.CLI
-h <hash>: stored hash (exact string produced byrexcrypt)-w <wordlist>: newline-separated candidates (blank + overlong lines are fine)-t <threads>: default = #CPUs, min 1, soft cap 64-v: verbose tracing to stderr (stdout reserved for the winner)Testing
Run everything:
Expect all green; sample end of TAP output:
The suite also covers:
hunter2still found (drain works)Notes for reviewers
sha1cryptlength is documented with a note (manpage discrepancy); current pattern matches real output on our systems. SunMD5 pattern follows docs; inconsistencies are commented for students.EX_SOFTWAREover generic failure; normal outcomes remain 0/2.Why this is useful (pedagogical goals)
crypt_r), shared I/O under a mutex, and handling of tricky inputs (overlong lines).How to review
Build both tools:
makeSmoke test:
Skim README “rexcrack” section and TESTING updates for clarity/accuracy.
(Optional) Try a different algorithm:
Commit highlights (latest first)
fix(rexcrack): adjust flag summary debug output and return precedencedocs(rexcrack,tests): add rexcrack usage, exit semantics, and TAP coveragebuild(makefile): quiet compiler outputrefactor(test): use new wordlist + add teststest(rexcrack): TAP cases for match/no-match/error; accept EX_* as errorfeat(rexcrack): multithreaded dictionary-attack demo (crypt_r + pthreads)Checklist
-Wall -Wextramake testpasses (TAP v14)rexcryptCLIReady for review.