Land #2175, force string encoding for RPC
Metasploit takes great pains to ensure that all strings are encoded as plain old US-ASCII. This PR enforces this conversion over RPC as well. [FixRM #7888]bug/bundler_fix
commit
1eb3c323ed
|
@ -23,7 +23,7 @@ class Service
|
||||||
|
|
||||||
attr_accessor :service, :srvhost, :srvport, :uri, :options
|
attr_accessor :service, :srvhost, :srvport, :uri, :options
|
||||||
attr_accessor :handlers, :default_handler, :tokens, :users, :framework
|
attr_accessor :handlers, :default_handler, :tokens, :users, :framework
|
||||||
attr_accessor :dispatcher_timeout, :token_timeout, :debug
|
attr_accessor :dispatcher_timeout, :token_timeout, :debug, :str_encoding
|
||||||
|
|
||||||
def initialize(framework, options={})
|
def initialize(framework, options={})
|
||||||
self.framework = framework
|
self.framework = framework
|
||||||
|
@ -36,6 +36,7 @@ class Service
|
||||||
:port => 3790
|
:port => 3790
|
||||||
}.merge(options)
|
}.merge(options)
|
||||||
|
|
||||||
|
self.str_encoding = ''.encoding.name
|
||||||
self.srvhost = self.options[:host]
|
self.srvhost = self.options[:host]
|
||||||
self.srvport = self.options[:port]
|
self.srvport = self.options[:port]
|
||||||
self.uri = self.options[:uri]
|
self.uri = self.options[:uri]
|
||||||
|
@ -121,6 +122,8 @@ class Service
|
||||||
raise ArgumentError, "Invalid Message Format"
|
raise ArgumentError, "Invalid Message Format"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
msg.map { |a| a.respond_to?(:force_encoding) ? a.force_encoding(self.str_encoding) : a }
|
||||||
|
|
||||||
group, funct = msg.shift.split(".", 2)
|
group, funct = msg.shift.split(".", 2)
|
||||||
|
|
||||||
if not self.handlers[group]
|
if not self.handlers[group]
|
||||||
|
|
Loading…
Reference in New Issue