Skip to content

Commit da92e47

Browse files
committed
2 parents 2f98a46 + abf199f commit da92e47

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

lib/msf/base/simple/auxiliary.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def self.run_simple(omod, opts = {}, &block)
5555

5656
# Verify the ACTION
5757
if (mod.actions.length > 0 and not mod.action)
58-
raise MissingActionError, "You must specify a valid Action", caller
58+
raise MissingActionError, "Please use: #{mod.actions.collect {|e| e.name} * ", "}"
5959
end
6060

6161
# Verify the options

lib/msf/core/exceptions.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,15 @@ def to_s
210210
###
211211
class MissingActionError < ArgumentError
212212
include AuxiliaryError
213+
attr_accessor :reason
214+
215+
def initialize(reason='')
216+
self.reason = reason
217+
super
218+
end
213219

214220
def to_s
215-
"A valid action has not been selected."
221+
"Invalid action: #{reason}"
216222
end
217223
end
218224

lib/msf/core/post.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ class Msf::Post < Msf::Module
1919

2020
include Msf::PostMixin
2121

22-
def setup; end
22+
def setup
23+
m = replicant
24+
if m.actions.length > 0 && !m.action
25+
raise Msf::MissingActionError, "Please use: #{m.actions.collect {|e| e.name} * ", "}"
26+
end
27+
end
2328

2429
def type
2530
Msf::MODULE_POST

0 commit comments

Comments
 (0)