Debian Codegraph @

src/samples/metadata_from_userpass.rb

raw
1 #!/usr/bin/env ruby
2 #
3 # Dislocker -- enables to read/write on BitLocker encrypted partitions under
4 # Linux
5 # Copyright (C) 2012-2013 Romain Coltel, Hervé Schauer Consultants
6 #
7 # This program is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License
9 # as published by the Free Software Foundation; either version 2
10 # of the License, or (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
20 # USA.
21 #
22
23 # $LOAD_PATH.unshift '@libdir@'
24 require '../libdislocker'
25
26
27 if ARGV.empty? or ARGV.length < 2
28 puts "Usage: #{$0} <volume path> <user pass> [<offset> [<block>]]"
29 exit 1
30 end
31
32 volume = ARGV[0]
33 userpass = ARGV[1]
34 offset = 0
35 block = 0
36
37 if ARGV.length > 2
38 offset = ARGV[2].to_i
39 end
40
41 if ARGV.length > 3
42 block = ARGV[3]
43 end
44
45 dismeta = Dislocker::Metadata.new volume, offset, block
46
47 disaccess = Dislocker::Accesses.new(dismeta)
48 disaccess.vmk_from_userpass userpass
49
50 fvek = disaccess.fvek
51
52 puts ". FVEK found:"
53 puts fvek