Skip to content

Commit 26743b4

Browse files
committed
Rewrite existing code to use HasActions
And fix a bug in the initial use case where mod.action was dropped.
1 parent 7e7e025 commit 26743b4

File tree

1 file changed

+5
-5
lines changed
  • lib/msf/ui/console/command_dispatcher

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2009,7 +2009,7 @@ def cmd_set_tabs(str, words)
20092009
res << 'ENCODER'
20102010
end
20112011

2012-
if (mod.auxiliary? or mod.post?)
2012+
if mod.kind_of?(Msf::Module::HasActions)
20132013
res << "ACTION"
20142014
end
20152015

@@ -2149,7 +2149,7 @@ def cmd_show(*args)
21492149
print_error("No exploit module selected.")
21502150
end
21512151
when "actions"
2152-
if (mod and (mod.auxiliary? or mod.post?))
2152+
if mod && mod.kind_of?(Msf::Module::HasActions)
21532153
show_actions(mod)
21542154
else
21552155
print_error("No auxiliary or post module selected.")
@@ -2721,8 +2721,8 @@ def tab_complete_option(str, words)
27212721
return option_values_encoders() if opt.upcase == 'StageEncoder'
27222722
end
27232723

2724-
# Well-known option names specific to auxiliaries and posts
2725-
if (mod.auxiliary? or mod.post?)
2724+
# Well-known option names specific to modules with actions
2725+
if mod.kind_of?(Msf::Module::HasActions)
27262726
return option_values_actions() if opt.upcase == 'ACTION'
27272727
end
27282728

@@ -3147,7 +3147,7 @@ def show_options(mod) # :nodoc:
31473147
end
31483148

31493149
# Print the selected action
3150-
if mod.kind_of?(Msf::Module::HasActions)
3150+
if mod.kind_of?(Msf::Module::HasActions) && mod.action
31513151
mod_action = Serializer::ReadableText.dump_module_action(mod, ' ')
31523152
print("\n#{mod.type.capitalize} action:\n\n#{mod_action}\n") if (mod_action and mod_action.length > 0)
31533153
end

0 commit comments

Comments
 (0)