Skip to content

Commit 7d8aa26

Browse files
committed
fix: better extension suggestion with an unknown command
1 parent 763f631 commit 7d8aa26

File tree

1 file changed

+3
-2
lines changed
  • lib/rex/post/meterpreter/ui/console/command_dispatcher

1 file changed

+3
-2
lines changed

lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,13 +1640,14 @@ def unknown_command(cmd, line)
16401640
if status.nil?
16411641
# Check to see if we can find this command in another extension. This relies on the core extension being the last
16421642
# in the dispatcher stack which it should be since it's the first loaded.
1643-
Rex::Post::Meterpreter::ExtensionMapper.get_extension_names.each do |ext_name|
1643+
Rex::Post::Meterpreter::ExtensionMapper.get_extension_names.select{ | ext_name | !ext_name.starts_with?('stdapi_')}.each do |ext_name|
16441644
next if extensions.include?(ext_name)
16451645
ext_klass = get_extension_client_class(ext_name)
16461646
next if ext_klass.nil?
16471647

16481648
if ext_klass.has_command?(cmd)
1649-
print_error("The \"#{cmd}\" command requires the \"#{ext_name}\" extension to be loaded (run: `load #{ext_name}`)")
1649+
print_error("The \"#{cmd}\" command requires the \"#{ext_name}\" extension to be loaded (run: `load #{ext_name}`)") if ext_name != "stdapi"
1650+
print_error("The \"#{cmd}\" command requires the stdapi extension to be loaded or the relative subcomponent (run: `load stdapi` or `load stdapi_audio/_fs/_net/_sys/_railgun/_ui/_webcam`)") if ext_name == "stdapi"
16501651
return :handled
16511652
end
16521653
end

0 commit comments

Comments
 (0)