remove the merge extension intialiser
this initialiser conflicts with the gemfication of framework and causes permissions issues MS-972bug/bundler_fix
parent
d49e0df5bd
commit
f7ce0dfedf
|
@ -42,44 +42,7 @@ module Metasploit::Framework::CommonEngine
|
||||||
# `initializer`s
|
# `initializer`s
|
||||||
#
|
#
|
||||||
|
|
||||||
initializer 'metasploit_framework.merge_meterpreter_extensions' do
|
|
||||||
Rails.application.railties.engines.each do |engine|
|
|
||||||
merge_meterpreter_extensions(engine)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# The Rails.application itself could have paths['data/meterpreter'], but will not be part of
|
|
||||||
# Rails.application.railties.engines because only direct subclasses of `Rails::Engine` are returned.
|
|
||||||
merge_meterpreter_extensions(Rails.application)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
#
|
|
||||||
# Instance Methods
|
|
||||||
#
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
# Merges the meterpreter extensions from `engine`'s `paths['data/meterpreter]`.
|
|
||||||
#
|
|
||||||
# @param engine [Rails::Engine] a Rails engine or application that has meterpreter extensions
|
|
||||||
# @return [void]
|
|
||||||
# @todo Make metasploit-framework look for meterpreter extension in paths['data/meterpreter'] from the engine instead of copying them.
|
|
||||||
def merge_meterpreter_extensions(engine)
|
|
||||||
data_meterpreter_paths = engine.paths['data/meterpreter']
|
|
||||||
|
|
||||||
# may be `nil` since 'data/meterpreter' is not part of the core Rails::Engine paths set.
|
|
||||||
if data_meterpreter_paths
|
|
||||||
source_paths = data_meterpreter_paths.existent
|
|
||||||
destination_directory = root.join('data', 'meterpreter').to_path
|
|
||||||
|
|
||||||
source_paths.each do |source_path|
|
|
||||||
basename = File.basename(source_path)
|
|
||||||
destination_path = File.join(destination_directory, basename)
|
|
||||||
|
|
||||||
unless destination_path == source_path
|
|
||||||
FileUtils.copy(source_path, destination_directory)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue