Get the path to an extension based on its name (no prefix).
# File lib/meterpreter_bins.rb, line 12 def self.ext_path(ext_name, binary_suffix) path("#{EXTENSION_PREFIX}#{ext_name}", binary_suffix) end
List all the available extensions for the given suffix.
# File lib/meterpreter_bins.rb, line 41 def self.list_extensions(binary_suffix) extensions = [] root_dirs = [local_dir] # Find the valid extensions in the data folder first, if MSF # is installed. root_dirs.unshift(metasploit_data_dir) if metasploit_installed? until root_dirs.length.zero? # Merge in any that don't already exist in the collection. enum_ext(root_dirs.shift, binary_suffix).each do |e| extensions.push(e) unless extensions.include?(e) end end extensions end
Get the path to a meterpreter binary by full name.
# File lib/meterpreter_bins.rb, line 19 def self.path(name, binary_suffix) file_name = "#{name}.#{binary_suffix}".downcase root_dirs = [local_dir] # Try the data folder first to see if the extension exists, as this # allows for the MSF data/meterpreter folder to override what is # in the gem. This is very helpful for testing/development without # having to move the binaries to the gem folder each time. We only # do this is MSF is installed. root_dirs.unshift(metasploit_data_dir) if metasploit_installed? until root_dirs.length.zero? file_path = expand(root_dirs.shift, file_name) return file_path if ::File.readable?(file_path) end nil end
Generated with the Darkfish Rdoc Generator 2.