forked from openwall/john
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lion2john-alt.pl
executable file
·35 lines (28 loc) · 878 Bytes
/
lion2john-alt.pl
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
#!/usr/bin/env perl
####
# This script converts an Apple OS X Lion plist file
# into a John the Ripper compatible "shadow" format.
# v0.1
#
# Copyright (c) 2011 Jean-Michel Picod <jean-michel.picod at cassidian.com>
# Redistribution and use in source and binary form, with or without
# modification, are permitted. (This is a heavily cut-down "BSD licence".)
####
use warnings;
use strict;
use Data::Plist;
use Data::Plist::BinaryReader;
sub usage {
print "Usage: $0 <plist file> ...\n";
exit(1);
}
usage() unless ($#ARGV >= 0);
while (my $f = shift @ARGV) {
my $reader = new Data::Plist::BinaryReader;
my $plist = $reader->open_file($f);
my $data = $plist->collapse($plist->raw_data);
my $user = $data->{'name'}[0];
my $hash = $plist->collapse($data->{'ShadowHashData'}[0]->raw_data);
print "$user:", (unpack("H*", $hash->{'SALTED-SHA512'})), "\n";
}
0;