Fix loading binary modules on Windows

[#36737359, #36401509]

Failed to follow HACKING guideline #5, open files in binary mode, so
Pro modules were being truncated on Windows installs.
This commit is contained in:
Luke Imhoff
2012-10-08 09:12:23 -05:00
parent e9b70a3a4f
commit ef6dad2bc3
+8 -1
View File
@@ -73,6 +73,13 @@ class Msf::Modules::Loader::Directory < Msf::Modules::Loader::Base
def read_module_content(parent_path, type, module_reference_name)
full_path = module_path(parent_path, type, module_reference_name)
::File.read(full_path)
module_content = ''
# force to read in binary mode so Pro modules won't be truncated on Windows
File.open(full_path, 'rb') do |f|
module_content = f.read
end
module_content
end
end