fix(ssh2john): correct bcrypt rounds assignment and update exception …#5975
Open
dejanazul wants to merge 1 commit intoopenwall:bleeding-jumbofrom
Open
fix(ssh2john): correct bcrypt rounds assignment and update exception …#5975dejanazul wants to merge 1 commit intoopenwall:bleeding-jumbofrom
dejanazul wants to merge 1 commit intoopenwall:bleeding-jumbofrom
Conversation
…handling This commit addresses two issues in the OpenSSH private key extraction process: 1. Exception Handling: Updated the decoding try-except block to catch `binascii.Error` directly, ensuring decode failures are handled gracefully in Python 3 environments. 2. Logic Bug: Fixed a fallback assignment issue for OpenSSH `bcrypt_pbkdf` keys. Replaced an incorrect equality check (`rounds == 16`) with an assignment (`rounds = 16`) so that the iteration count defaults correctly when initially read as 0.
magnumripper
approved these changes
Apr 14, 2026
solardiz
reviewed
Apr 24, 2026
| data = ''.join(lines[start:end]).encode() | ||
| data = base64.b64decode(data) | ||
| except base64.binascii.Error: | ||
| except binascii.Error: |
Member
There was a problem hiding this comment.
I wonder if this was maybe a Python 2 vs. 3 modules thing? I think we had this script try to work with either version, as indicated by the shebang not specifying a version.
Member
There was a problem hiding this comment.
Oh, you actually wrote "in Python 3 environments." So I wonder what this means for Python 2, then? If this script does not support Python 2 anymore (which would be mildly unfortunate), then we need to update the shebang to python3.
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.
…handling
This commit addresses two issues in the OpenSSH private key extraction process:
binascii.Errordirectly, ensuring decode failures are handled gracefully in Python 3 environments.bcrypt_pbkdfkeys. Replaced an incorrect equality check (rounds == 16) with an assignment (rounds = 16) so that the iteration count defaults correctly when initially read as 0.