Skip to content

Commit

Permalink
Add authenticator2john.py to extract authenticator app passwords. Closes
Browse files Browse the repository at this point in the history
  • Loading branch information
marksilinio committed Nov 26, 2021
1 parent b8fa784 commit 971d74e
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
4 changes: 4 additions & 0 deletions doc/NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ Major changes from 1.9.0-jumbo-1 (May 2019) in this bleeding-edge version:
large portion of a mask should be generated on device-side (or completely
disabling internal mask). [magnum; 2021]

- Added authenticator2john.py: script to extract and format
https://github.com/JeNeSuisPasDave/authenticator app passwords.
[Mark Silinio; 2021]


Major changes from 1.8.0-jumbo-1 (December 2014) to 1.9.0-jumbo-1 (May 2019):

Expand Down
35 changes: 35 additions & 0 deletions run/authenticator2john.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env python

# This software is Copyright (c) 2021 Mark Silinio <mark.silinio-at-gmail.com>,
# and it is hereby released to the general public under the following terms:
# Redistribution and use in source and binary forms, with or without
# modification, are permitted.
#
# Extract and format https://github.com/JeNeSuisPasDave/authenticator app password for cracking with JtR
# Usage: ./authenticator2john.py <authenticator.data file>

import os
import sys
from binascii import hexlify

if len(sys.argv) < 2:
print('Usage: ./authenticator2john.py <authenticator.data files>')
exit(1)

filenames = sys.argv[1:]

for filename in filenames:
bname = os.path.basename(filename)
try:
f = open(filename, "rb")
data = f.read()
except IOError:
e = sys.exc_info()[1]
sys.stderr.write("%s\n" % str(e))
exit(1)

iv = data[:16]
encrypted_data = data[16:32]
iv = hexlify(iv).decode("ascii")
encrypted_data = hexlify(encrypted_data).decode("ascii")
sys.stdout.write("%s:$authenticator$0$%s$%s\n" % (bname, iv, encrypted_data))

0 comments on commit 971d74e

Please sign in to comment.