Add batch scanner external module type

MS-2855/keylogger-mettle-extension
Adam Cammack 2018-01-16 20:49:20 -06:00
parent fb41eea8cc
commit a5be16f74e
No known key found for this signature in database
GPG Key ID: C9378BA088092D66
2 changed files with 47 additions and 1 deletions

View File

@ -13,6 +13,8 @@ class Msf::Modules::External::Shim
capture_server(mod) capture_server(mod)
when 'dos' when 'dos'
dos(mod) dos(mod)
when 'scanner.multi'
multi_scanner(mod)
else else
# TODO have a nice load error show up in the logs # TODO have a nice load error show up in the logs
'' ''
@ -35,7 +37,7 @@ class Msf::Modules::External::Shim
meta[:authors] = mod.meta['authors'].map(&:dump).join(",\n ") meta[:authors] = mod.meta['authors'].map(&:dump).join(",\n ")
meta[:options] = mod.meta['options'].map do |n, o| meta[:options] = mod.meta['options'].map do |n, o|
"Opt#{o['type'].capitalize}.new(#{n.dump}, "Opt#{o['type'].camelize}.new(#{n.dump},
[#{o['required']}, #{o['description'].dump}, #{o['default'].inspect}])" [#{o['required']}, #{o['description'].dump}, #{o['default'].inspect}])"
end.join(",\n ") end.join(",\n ")
meta meta
@ -69,6 +71,16 @@ class Msf::Modules::External::Shim
render_template('capture_server.erb', meta) render_template('capture_server.erb', meta)
end end
def self.multi_scanner(mod)
meta = mod_meta_common(mod)
meta[:date] = mod.meta['date'].dump
meta[:references] = mod.meta['references'].map do |r|
"[#{r['type'].upcase.dump}, #{r['ref'].dump}]"
end.join(",\n ")
render_template('multi_scanner.erb', meta)
end
def self.dos(mod) def self.dos(mod)
meta = mod_meta_common(mod) meta = mod_meta_common(mod)
meta[:date] = mod.meta['date'].dump meta[:date] = mod.meta['date'].dump

View File

@ -0,0 +1,34 @@
require 'msf/core/modules/external/bridge'
require 'msf/core/module/external'
class MetasploitModule < Msf::Auxiliary
include Msf::Auxiliary::Scanner
include Msf::Module::External
def initialize
super({
<%= common_metadata meta %>
'References' =>
[
<%= meta[:references] %>
],
'DisclosureDate' => <%= meta[:date] %>,
})
register_options([
<%= meta[:options] %>
])
end
def run_batch_size
200
end
def run_batch(ips)
mod = Msf::Modules::External::Bridge.open(<%= meta[:path] %>)
datastore.delete('RHOSTS')
datastore['rhosts'] = ips
mod.run(datastore)
wait_status(mod)
end
end