Factor external check shim into common template

GSoC/Meterpreter_Web_Console
Adam Cammack 2018-05-14 11:32:22 -05:00
parent 1d168a84e5
commit ac03a0723a
No known key found for this signature in database
GPG Key ID: C9378BA088092D66
3 changed files with 12 additions and 6 deletions

View File

@ -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

View File

@ -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 %>

View File

@ -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))