Actionable hashcat error on GPU-less environments - #111
Open
mkultraWasHere wants to merge 3 commits into
Open
Conversation
…ckend On GPU-less VMs, hashcat exits with CL_PLATFORM_NOT_FOUND_KHR and the agent gets an opaque error. Catch this specific failure and raise with a clear message directing the agent to use john_the_ripper instead, including the correct hash_format for known modes. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR improves the network-ops cracking tool UX on GPU-less environments by turning common hashcat “no backend” failures into actionable guidance that suggests using john_the_ripper, including mode→format hints for a few known hash types.
Changes:
- Added hashcat-mode → john-format mapping for a small set of common modes.
- Intercepted hashcat failures that look like missing OpenCL/CUDA/HIP backends and raised a clearer, actionable error message.
- Minor formatting adjustments for readability of some
execute(...)calls.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+93
to
+107
| except Exception as e: | ||
| msg = str(e) | ||
| if any(marker in msg for marker in _NO_BACKEND_MARKERS): | ||
| john_fmt = HASHCAT_TO_JOHN.get(hashcat_mode) | ||
| if john_fmt: | ||
| raise RuntimeError( | ||
| f"hashcat failed: no OpenCL/CUDA/HIP backend available. " | ||
| f"Use john_the_ripper instead with hash_format='{john_fmt}'." | ||
| ) from e | ||
| raise RuntimeError( | ||
| f"hashcat failed: no OpenCL/CUDA/HIP backend available. " | ||
| f"Use john_the_ripper instead (hashcat mode {hashcat_mode} " | ||
| f"has no automatic john format mapping — consult john documentation)." | ||
| ) from e | ||
| raise |
Contributor
Author
There was a problem hiding this comment.
Fixed in 7d206d2 — added three tests: backend marker with known mode, unknown mode, and non-backend error propagation.
| ["hashcat", "-m", str(hashcat_mode), hash_file_path, "--show"] | ||
| ) | ||
|
|
||
| @tool_method(catch=True, variants=["john", "all"]) |
Contributor
Author
There was a problem hiding this comment.
Fixed in 7d206d2 — added "hashcat" to john_the_ripper's variant list so both tools are registered together under the default variant.
…john under hashcat variant Add three tests covering backend-marker detection (known mode, unknown mode, non-backend error propagation). Register john_the_ripper under the hashcat variant so the fallback suggestion is actionable. Co-Authored-By: Claude <noreply@anthropic.com>
Drop the unknown-mode test (just a dict miss) and add a test verifying the original hashcat error is preserved as __cause__ on the re-raised RuntimeError. Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On GPU-less VMs,
hashcatexits immediately withCL_PLATFORM_NOT_FOUND_KHRand the agent gets an opaque error with no guidance on how to proceed.Fixed
hashcattool no longer returns an opaque error on environments without OpenCL/CUDA/HIP — it now tells the agent to usejohn_the_ripperwith the correcthash_formatfor known modes (1000→nt, 2100→mscash2, 13100→krb5tgs, 18200→krb5asrep)Notes
john_the_ripperitself