Fix metsrv.dll name issue

As mentioned here https://community.rapid7.com/thread/3788 the metsvc
script was still looking for the old file name for metsrv.dll, which
was causing the script to fail.

This commit fixes this issue. A hash is used to indicate local and remote
file names so that the remote can continue to use metsrv.dll, but it
is correctly located on disk locally.
bug/bundler_fix
OJ 2013-11-28 11:48:11 +10:00
parent 77b036ce5d
commit 0c59c885c4
1 changed files with 15 additions and 5 deletions

View File

@ -70,11 +70,21 @@ if client.platform =~ /win32|win64/
print_status("Creating a temporary installation directory #{tempdir}...")
client.fs.dir.mkdir(tempdir)
%W{ metsrv.dll metsvc-server.exe metsvc.exe }.each do |bin|
next if (bin != "metsvc.exe" and remove)
print_status(" >> Uploading #{bin}...")
fd = client.fs.file.new(tempdir + "\\" + bin, "wb")
fd.write(::File.read(File.join(based, bin), ::File.size(::File.join(based, bin))))
# Use an array of `from -> to` associations so that things
# such as metsrv can be copied from the appropriate location
# but named correctly on the target.
bins = {
'metsrv.x86.dll' => 'metsrv.dll',
'metsvc-server.exe' => nil,
'metsvc.exe' => nil
}
bins.each do |from, to|
next if (from != "metsvc.exe" and remove)
to ||= from
print_status(" >> Uploading #{from}...")
fd = client.fs.file.new(tempdir + "\\" + to, "wb")
fd.write(::File.read(File.join(based, from), ::File.size(::File.join(based, from))))
fd.close
end