Skip to content

Actionable hashcat error on GPU-less environments - #111

Open
mkultraWasHere wants to merge 3 commits into
mainfrom
feat/hashcat-cpu-fallback
Open

Actionable hashcat error on GPU-less environments#111
mkultraWasHere wants to merge 3 commits into
mainfrom
feat/hashcat-cpu-fallback

Conversation

@mkultraWasHere

Copy link
Copy Markdown
Contributor

On GPU-less VMs, hashcat exits immediately with CL_PLATFORM_NOT_FOUND_KHR and the agent gets an opaque error with no guidance on how to proceed.

Fixed

  • hashcat tool no longer returns an opaque error on environments without OpenCL/CUDA/HIP — it now tells the agent to use john_the_ripper with the correct hash_format for known modes (1000→nt, 2100→mscash2, 13100→krb5tgs, 18200→krb5asrep)

Notes

  • Non-backend hashcat failures (bad hash format, corrupted file, etc.) still propagate unchanged
  • No auto-fallback — the agent receives the error and decides to call john_the_ripper itself

…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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"])

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 7d206d2 — added "hashcat" to john_the_ripper's variant list so both tools are registered together under the default variant.

mkultraWasHere and others added 2 commits August 2, 2026 19:50
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants