Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions run/ssh2john.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def read_private_key(filename):
try:
data = ''.join(lines[start:end]).encode()
data = base64.b64decode(data)
except base64.binascii.Error:
except binascii.Error:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

e = sys.exc_info()[1]
raise Exception('base64 decoding error: ' + str(e))

Expand Down Expand Up @@ -178,7 +178,7 @@ def read_private_key(filename):
rounds = data[rounds_offset: rounds_offset+4]
rounds = unpack(">I", rounds)[0]
if rounds == 0:
rounds == 16
rounds = 16

keysize = CIPHER_TABLE[encryption_type]['keysize']
salt = binascii.unhexlify(saltstr)
Expand Down