Skip to content

Commit 601a88d

Browse files
committed
Update cmd_unload in CommandDispatcher
1 parent 2ad29a2 commit 601a88d

File tree

1 file changed

+9
-10
lines changed
  • lib/msf/ui/console/command_dispatcher

1 file changed

+9
-10
lines changed

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

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,16 +1653,15 @@ def cmd_unload(*args)
16531653
return false
16541654
end
16551655

1656-
# Walk the plugins array
1657-
framework.plugins.each { |plugin|
1658-
# Unload the plugin if it matches the name we're searching for
1659-
if (plugin.name.downcase == args[0].downcase)
1660-
print("Unloading plugin #{args[0]}...")
1661-
framework.plugins.unload(plugin)
1662-
print_line("unloaded.")
1663-
break
1664-
end
1665-
}
1656+
# Find a plugin within the plugins array
1657+
plugin = framework.plugins.find { |p| p.name.downcase == args[0].downcase }
1658+
1659+
# Unload the plugin if it matches the name we're searching for
1660+
if plugin
1661+
print("Unloading plugin #{args[0]}...")
1662+
framework.plugins.unload(plugin)
1663+
print_line("unloaded.")
1664+
end
16661665
end
16671666

16681667
#

0 commit comments

Comments
 (0)