Skip to content

Commit 0800a4f

Browse files
committed
Update RPC functionality
1 parent 601a88d commit 0800a4f

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

lib/msf/core/rpc/v10/rpc_plugin.rb

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,16 @@ def rpc_load(path, xopts = {})
5757
# @example Here's how you would use this from the client:
5858
# rpc.call('plugin.unload', 'nexpose')
5959
def rpc_unload(name)
60-
self.framework.plugins.each { |plugin|
61-
# Unload the plugin if it matches the name we're searching for
62-
if (plugin.name == name)
63-
self.framework.plugins.unload(plugin)
64-
return { "result" => "success" }
65-
end
66-
}
67-
return { "result" => "failure" }
60+
# Find a plugin within the plugins array
61+
plugin = self.framework.plugins.find { |p| p.name == name }
6862

63+
# Unload the plugin if it matches the name we're searching for
64+
if plugin
65+
self.framework.plugins.unload(plugin)
66+
return { "result" => "success" }
67+
end
68+
69+
return { "result" => "failure" }
6970
end
7071

7172

0 commit comments

Comments
 (0)