Skip to content

Commit ff43fbd

Browse files
author
Tod Beardsley
committed
Land rapid7#4509, private/protected workaround for 2.1.5
Fixes rapid7#4507. See also rapid7#4506 (but does not fix this yet).
2 parents 5596cee + d45cdd6 commit ff43fbd

File tree

13 files changed

+26
-26
lines changed

13 files changed

+26
-26
lines changed

lib/msf/core/event_dispatcher.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,23 +179,23 @@ def method_missing(name, *args)
179179
if respond_to?(subscribers, true)
180180
found = true
181181
self.send(subscribers).each do |sub|
182-
next if not sub.respond_to?(name)
182+
next if not sub.respond_to?(name, true)
183183
sub.send(name, *args)
184184
end
185185
else
186186
(general_event_subscribers + custom_event_subscribers).each do |sub|
187-
next if not sub.respond_to?(name)
187+
next if not sub.respond_to?(name, true)
188188
sub.send(name, *args)
189189
found = true
190190
end
191191
end
192192
when "add"
193-
if respond_to?(subscribers)
193+
if respond_to?(subscribers, true)
194194
found = true
195195
add_event_subscriber(self.send(subscribers), *args)
196196
end
197197
when "remove"
198-
if respond_to?(subscribers)
198+
if respond_to?(subscribers, true)
199199
found = true
200200
remove_event_subscriber(self.send(subscribers), *args)
201201
end

lib/msf/core/exploit/ftpserver.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def on_client_data(c)
7878
return if not cmd
7979

8080
# Allow per-command overrides
81-
if(self.respond_to?("on_client_command_#{cmd.downcase}"))
81+
if self.respond_to?("on_client_command_#{cmd.downcase}", true)
8282
return self.send("on_client_command_#{cmd.downcase}", c, arg)
8383
end
8484

lib/msf/core/post/osx/ruby_dl.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ module Importable
3232
def method_missing(meth, *args, &block)
3333
str = meth.to_s
3434
lower = str[0,1].downcase + str[1..-1]
35-
if self.respond_to? lower
35+
if self.respond_to?(lower, true)
3636
self.send lower, *args
3737
else
3838
super

lib/msf/ui/console/command_dispatcher/auxiliary.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def commands
3939
# Allow modules to define their own commands
4040
#
4141
def method_missing(meth, *args)
42-
if (mod and mod.respond_to?(meth.to_s))
42+
if (mod and mod.respond_to?(meth.to_s, true) )
4343

4444
# Initialize user interaction
4545
mod.init_ui(driver.input, driver.output)

lib/msf/ui/console/command_dispatcher/db.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,13 +1088,13 @@ def cmd_notes(*args)
10881088
end
10891089
elsif term == "output"
10901090
orderlist << make_sortable(note.data["output"])
1091-
elsif note.respond_to?(term)
1091+
elsif note.respond_to?(term, true)
10921092
orderlist << make_sortable(note.send(term))
1093-
elsif note.respond_to?(term.to_sym)
1093+
elsif note.respond_to?(term.to_sym, true)
10941094
orderlist << make_sortable(note.send(term.to_sym))
1095-
elsif note.respond_to?("data") && note.send("data").respond_to?(term)
1095+
elsif note.respond_to?("data", true) && note.send("data").respond_to?(term, true)
10961096
orderlist << make_sortable(note.send("data").send(term))
1097-
elsif note.respond_to?("data") && note.send("data").respond_to?(term.to_sym)
1097+
elsif note.respond_to?("data", true) && note.send("data").respond_to?(term.to_sym, true)
10981098
orderlist << make_sortable(note.send("data").send(term.to_sym))
10991099
else
11001100
orderlist << ""
@@ -1682,7 +1682,7 @@ def cmd_db_connect(*args)
16821682
end
16831683
end
16841684
meth = "db_connect_#{framework.db.driver}"
1685-
if(self.respond_to?(meth))
1685+
if(self.respond_to?(meth, true))
16861686
self.send(meth, *args)
16871687
if framework.db.active and not framework.db.modules_cached
16881688
print_status("Rebuilding the module cache in the background...")

lib/rabal/tree.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def walk(tree,method)
173173
# Tree that responds to the call.
174174
#
175175
def method_missing(method_id,*params,&block)
176-
if not parameters.nil? and parameters.respond_to?(method_id) then
176+
if not parameters.nil? and parameters.respond_to?(method_id, true) then
177177
return parameters.send(method_id, *params, &block)
178178
elsif not is_root? then
179179
@parent.send method_id, *params, &block

lib/rex/parser/foundstone_nokogiri.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def first_line(str)
293293
# XXX: Actually implement more of these
294294
def process_service(service,banner)
295295
meth = "process_service_#{service.gsub("-","_")}"
296-
if self.respond_to? meth
296+
if self.respond_to?(meth, true)
297297
self.send meth, banner
298298
else
299299
return (first_line banner)

lib/rex/payloads/win32/kernel.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def self.construct(opts = {})
2424
payload = nil
2525

2626
# Generate the recovery stub
27-
if opts['Recovery'] and Kernel::Recovery.respond_to?(opts['Recovery'])
27+
if opts['Recovery'] and Kernel::Recovery.respond_to?(opts['Recovery'], true)
2828
opts['RecoveryStub'] = Kernel::Recovery.send(opts['Recovery'], opts)
2929
end
3030

@@ -35,10 +35,10 @@ def self.construct(opts = {})
3535
end
3636

3737
# Generate the stager
38-
if opts['Stager'] and Kernel::Stager.respond_to?(opts['Stager'])
38+
if opts['Stager'] and Kernel::Stager.respond_to?(opts['Stager'], true)
3939
payload = Kernel::Stager.send(opts['Stager'], opts)
4040
# Or, generate the migrator
41-
elsif opts['Migrator'] and Kernel::Migration.respond_to?(opts['Migrator'])
41+
elsif opts['Migrator'] and Kernel::Migration.respond_to?(opts['Migrator'], true)
4242
payload = Kernel::Migration.send(opts['Migrator'], opts)
4343
else
4444
raise ArgumentError, "A stager or a migrator must be specified."

lib/rex/ui/text/dispatcher_shell.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def deprecated_cmd(method=nil, *args)
105105
print_error "The #{cmd} command is DEPRECATED"
106106
if cmd == "db_autopwn"
107107
print_error "See http://r-7.co/xY65Zr instead"
108-
elsif method and self.respond_to?("cmd_#{method}")
108+
elsif method and self.respond_to?("cmd_#{method}", true)
109109
print_error "Use #{method} instead"
110110
self.send("cmd_#{method}", *args)
111111
end
@@ -116,7 +116,7 @@ def deprecated_help(method=nil)
116116
print_error "The #{cmd} command is DEPRECATED"
117117
if cmd == "db_autopwn"
118118
print_error "See http://r-7.co/xY65Zr instead"
119-
elsif method and self.respond_to?("cmd_#{method}_help")
119+
elsif method and self.respond_to?("cmd_#{method}_help", true)
120120
print_error "Use 'help #{method}' instead"
121121
self.send("cmd_#{method}_help")
122122
end
@@ -150,9 +150,9 @@ def cmd_help(cmd=nil, *ignored)
150150
next if (dispatcher.commands.nil?)
151151
next if (dispatcher.commands.length == 0)
152152

153-
if dispatcher.respond_to?("cmd_#{cmd}")
153+
if dispatcher.respond_to?("cmd_#{cmd}", true)
154154
cmd_found = true
155-
break unless dispatcher.respond_to? "cmd_#{cmd}_help"
155+
break unless dispatcher.respond_to?("cmd_#{cmd}_help", true)
156156
dispatcher.send("cmd_#{cmd}_help")
157157
help_found = true
158158
break

modules/exploits/linux/misc/hikvision_rtsp_bof.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def initialize(info = {})
7979
end
8080

8181
def exploit
82-
unless self.respond_to?(target[:callback])
82+
unless self.respond_to?(target[:callback], true)
8383
fail_with(Failure::NoTarget, "Invalid target specified: no callback function defined")
8484
end
8585

0 commit comments

Comments
 (0)