Skip to content

Commit 971d74e

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

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

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

run/authenticator2john.py

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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 to the general public under the following terms:
5+
# Redistribution and use in source and binary forms, with or without
6+
# modification, are permitted.
7+
#
8+
# Extract and format https://github.com/JeNeSuisPasDave/authenticator app password for cracking with JtR
9+
# Usage: ./authenticator2john.py <authenticator.data file>
10+
11+
import os
12+
import sys
13+
from binascii import hexlify
14+
15+
if len(sys.argv) < 2:
16+
print('Usage: ./authenticator2john.py <authenticator.data files>')
17+
exit(1)
18+
19+
filenames = sys.argv[1:]
20+
21+
for filename in filenames:
22+
bname = os.path.basename(filename)
23+
try:
24+
f = open(filename, "rb")
25+
data = f.read()
26+
except IOError:
27+
e = sys.exc_info()[1]
28+
sys.stderr.write("%s\n" % str(e))
29+
exit(1)
30+
31+
iv = data[:16]
32+
encrypted_data = data[16:32]
33+
iv = hexlify(iv).decode("ascii")
34+
encrypted_data = hexlify(encrypted_data).decode("ascii")
35+
sys.stdout.write("%s:$authenticator$0$%s$%s\n" % (bname, iv, encrypted_data))

0 commit comments

Comments
 (0)