Skip to content

Commit

Permalink
Fix TypeError with python 3.11+ for mozilla2john #5431
Browse files Browse the repository at this point in the history
  • Loading branch information
Munto authored and solardiz committed Feb 2, 2024
1 parent 173b562 commit f55f420
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions run/mozilla2john.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def process_file(filename):

data = open(filename, "rb").read()

idx = data.find("global-salt")
idx = data.find(b"global-salt")
if idx < 0:
fail(filename)
return
Expand All @@ -40,7 +40,7 @@ def process_file(filename):
return
global_salt = data[idx-20:][0:20] # is the salt always 20 bytes?

idx = data.find("password-check")
idx = data.find(b"password-check")
if idx < 0:
fail(filename)
return
Expand All @@ -55,7 +55,7 @@ def process_file(filename):
version = 3 # fake (this should be improved)
nnLen = 1 # fake
oidLen = 11 # fake
oidData = "\x00" * oidLen # fake
oidData = b"\x00" * oidLen # fake
sys.stdout.write("%s:$mozilla$*%s*%s*%s*" % (os.path.basename(filename), version, len(entry_salt), nnLen))
sys.stdout.write(hexlify(entry_salt).decode("ascii"))
sys.stdout.write("*%s*%s*%s*" % (oidLen, hexlify(oidData).decode("ascii"), len(verifier)))
Expand Down

0 comments on commit f55f420

Please sign in to comment.