Class: Msf::Exploit::Remote::HTTP::Exchange::ProxyMaybeShell::XMLTemplate

Inherits:
Object
  • Object
show all
Defined in:
lib/msf/core/exploit/remote/http/exchange/proxy_maybe_shell.rb

Class Method Summary collapse

Class Method Details

.render(template_name, context = nil) ⇒ Object



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/msf/core/exploit/remote/http/exchange/proxy_maybe_shell.rb', line 97

def self.render(template_name, context = nil)
  file_path = ::File.join(::Msf::Config.data_directory, 'exploits', 'proxymaybeshell', "#{template_name}.xml.erb")
  template = ::File.binread(file_path)
  case context
  when Hash
    b = binding
    locals = context.collect { |k, _| "#{k} = context[#{k.inspect}]; " }
    b.eval(locals.join)
  when NilClass
    b = binding
  else
    raise ArgumentError
  end
  b.eval(Erubi::Engine.new(template).src)
end