Skip to content

Commit 0c0531f

Browse files
committed
Add authenticator2john.py to extract authenticator app passwords. Closes #4893
1 parent b8fa784 commit 0c0531f

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

Diff for: doc/NEWS

+4
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,10 @@ Major changes from 1.9.0-jumbo-1 (May 2019) in this bleeding-edge version:
238238
large portion of a mask should be generated on device-side (or completely
239239
disabling internal mask). [magnum; 2021]
240240

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

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

Diff for: run/authenticator2john.py

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env python
2+
3+
# This software is Copyright (c) 2021 Mark Silinio <mark.silinio-at-gmail.com>,
4+
# and it is hereby released under GPL v2 license.
5+
#
6+
# Extract and format https://github.com/JeNeSuisPasDave/authenticator app password for cracking with JtR
7+
# Usage: ./authenticator2john.py <authenticator.data file>
8+
9+
import os
10+
import sys
11+
from binascii import hexlify
12+
13+
if len(sys.argv) < 2:
14+
print('Usage: ./authenticator2john.py <authenticator.data files>')
15+
exit(1)
16+
17+
filenames = sys.argv[1:]
18+
19+
for filename in filenames:
20+
bname = os.path.basename(filename)
21+
try:
22+
f = open(filename, "rb")
23+
data = f.read()
24+
except IOError:
25+
e = sys.exc_info()[1]
26+
sys.stderr.write("%s\n" % str(e))
27+
exit(1)
28+
29+
iv = data[:16]
30+
encrypted_data = data[16:32]
31+
iv = hexlify(iv).decode("ascii")
32+
encrypted_data = hexlify(encrypted_data).decode("ascii")
33+
sys.stdout.write("%s:$authenticator$0$%s$%s\n" % (bname, iv, encrypted_data))

0 commit comments

Comments
 (0)