Factor external check shim into common template
parent
1d168a84e5
commit
ac03a0723a
|
@ -32,6 +32,10 @@ class Msf::Modules::External::Shim
|
|||
render_template('common_metadata.erb', meta)
|
||||
end
|
||||
|
||||
def self.common_check(meta = {})
|
||||
render_template('common_check.erb', meta)
|
||||
end
|
||||
|
||||
def self.mod_meta_common(mod, meta = {}, drop_rhost: false)
|
||||
meta[:path] = mod.path.dump
|
||||
meta[:name] = mod.meta['name'].dump
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<% if meta[:capabilities].include? 'soft_check' %>
|
||||
def check
|
||||
code = execute_module(<%= meta[:path] %>, method: :soft_check, fail_on_exit: false) || 'unknown'
|
||||
return Msf::Exploit::CheckCode::Codes[code]
|
||||
end
|
||||
<% end %>
|
||||
|
|
@ -34,12 +34,7 @@ class MetasploitModule < Msf::Exploit::Remote
|
|||
])
|
||||
end
|
||||
|
||||
<% if meta[:capabilities].include? 'soft_check' %>
|
||||
def check
|
||||
code = execute_module(<%= meta[:path] %>, method: :soft_check, fail_on_exit: false) || 'unknown'
|
||||
return Msf::Exploit::CheckCode::Codes[code]
|
||||
end
|
||||
<% end %>
|
||||
<%= common_check meta %>
|
||||
|
||||
def execute_command(cmd, opts)
|
||||
execute_module(<%= meta[:path] %>, args: datastore.merge(command: cmd))
|
||||
|
|
Loading…
Reference in New Issue