forked from openwall/john
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharuba2john.py
executable file
·49 lines (38 loc) · 1.41 KB
/
aruba2john.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env python
# This software is Copyright (c) 2017, Dhiru Kholia <dhiru at openwall.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.
"""
ArubaOS password hashing algorithm details were found by Sven Blumenstein.
http://seclists.org/fulldisclosure/2016/May/19
"""
import sys
def process_file(filename):
with open(filename, "r") as f:
for line in f.readlines():
username = None
data = line.rstrip().split(":")
if len(data) > 1: # are usernames present?
username = data[0]
rest = data[1]
else:
rest = data[0]
if len(rest) != 50:
sys.stderr.write("Skipping hash of unsupported length -> %s\n" % rest)
continue
# first 5 bytes are the salt
salt = rest[0:10]
h = rest[10:]
output = "$dynamic_25$%s$HEX$%s" % (h, salt)
if username:
sys.stdout.write("%s:%s\n" % (username, output))
else:
sys.stdout.write("%s\n" % output)
if __name__ == "__main__":
if len(sys.argv) < 2:
sys.stderr.write("Usage: %s <ArubaOS hashes file>\n" % sys.argv[0])
sys.exit(1)
for i in range(1, len(sys.argv)):
process_file(sys.argv[i])