Resolve a number of problems with the new multi modules
git-svn-id: file:///home/svn/framework3/trunk@13249 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
parent
775257320d
commit
33ce5df8ca
|
@ -12,20 +12,22 @@
|
|||
require 'msf/core'
|
||||
|
||||
class Metasploit3 < Msf::Post
|
||||
include Msf::Ui::Console
|
||||
|
||||
def initialize(info={})
|
||||
super( update_info( info,
|
||||
'Name' => 'Multi Manage Execute Meterpreter Console Command',
|
||||
'Description' => %q{ Run a given Meterpreter console command against
|
||||
specified sessions.},
|
||||
'Description' => %q{
|
||||
Run a Meterpreter console command against a set of
|
||||
specified sessions.
|
||||
},
|
||||
'License' => MSF_LICENSE,
|
||||
'Author' => [ 'Carlos Perez <carlos_perez[at]darkoperator.com>'],
|
||||
'Version' => '$Revision$'
|
||||
))
|
||||
register_options(
|
||||
[
|
||||
OptString.new('SESSIONS', [true, 'Specify either ALL for all sessions or a comman separated list of sessions.', nil]),
|
||||
OptString.new('COMMAND', [true, 'Meterpreter Console command.', nil])
|
||||
OptString.new('SESSIONS', [true, 'Specify either ALL for all sessions or a comma-separated list of sessions']),
|
||||
OptString.new('COMMAND', [true, 'Meterpreter console command.', nil])
|
||||
], self.class)
|
||||
end
|
||||
|
||||
|
@ -51,13 +53,14 @@ class Metasploit3 < Msf::Post
|
|||
|
||||
# Check if session is meterpreter and run command.
|
||||
if (session.type == "meterpreter")
|
||||
print_good("Running command #{command} against sessions #{s}")
|
||||
print_good("Running command #{command} against session #{s}")
|
||||
session.console.run_single(command)
|
||||
else
|
||||
print_error("Sessions #{s} is not a Meterpreter Sessions!")
|
||||
print_error("Session #{s} is not a Meterpreter session!")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -12,19 +12,21 @@
|
|||
require 'msf/core'
|
||||
|
||||
class Metasploit3 < Msf::Post
|
||||
include Msf::Ui::Console
|
||||
|
||||
def initialize(info={})
|
||||
super( update_info( info,
|
||||
'Name' => 'Multi Manage Execute Meterpreter Console Command Resource File',
|
||||
'Description' => %q{Execute Meterpreter Console Commands in resourcefileagainst
|
||||
specified sessions.},
|
||||
'Description' => %q{
|
||||
Execute Meterpreter console commands defined in a resource file against
|
||||
specific sessions.
|
||||
},
|
||||
'License' => MSF_LICENSE,
|
||||
'Author' => [ 'Carlos Perez <carlos_perez[at]darkoperator.com>'],
|
||||
'Version' => '$Revision$'
|
||||
))
|
||||
register_options(
|
||||
[
|
||||
OptString.new('RESOURCE', [true, 'Resource file with space separate values <session> <command>, per line.', nil])
|
||||
OptPath.new('RESOURCE', [true, "Resource file with space-separated values in the form of: '<session> <command>'"])
|
||||
], self.class)
|
||||
end
|
||||
|
||||
|
@ -42,7 +44,7 @@ class Metasploit3 < Msf::Post
|
|||
entries << line.chomp
|
||||
end
|
||||
else
|
||||
print_error("Resourse file does not exist.")
|
||||
print_error("Resource file does not exist.")
|
||||
end
|
||||
|
||||
entries.each do |entrie|
|
||||
|
@ -53,7 +55,7 @@ class Metasploit3 < Msf::Post
|
|||
else
|
||||
sessions = session_parm.split(",")
|
||||
end
|
||||
|
||||
|
||||
sessions.each do |s|
|
||||
# Check if session is in the current session list.
|
||||
next if not current_sessions.include?(s.to_i)
|
||||
|
@ -63,14 +65,15 @@ class Metasploit3 < Msf::Post
|
|||
|
||||
# Check if session is meterpreter and run command.
|
||||
if (session.type == "meterpreter")
|
||||
print_good("Running command #{command} against sessions #{s}")
|
||||
print_good("Running command #{command} against session #{s}")
|
||||
session.console.run_single(command)
|
||||
else
|
||||
print_error("Sessions #{s} is not a Meterpreter Sessions!")
|
||||
print_error("Session #{s} is not a Meterpreter sessions!")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -12,22 +12,21 @@
|
|||
require 'msf/core'
|
||||
|
||||
class Metasploit3 < Msf::Post
|
||||
include Msf::Ui::Console
|
||||
|
||||
def initialize(info={})
|
||||
super( update_info( info,
|
||||
'Name' => 'Multi Manage Post Moudule Execution Automation',
|
||||
'Description' => %q{ Run specified module against a a given set
|
||||
of sessions or all sessions.},
|
||||
'Name' => 'Multi Manage Post Module Execution Automation',
|
||||
'Description' => %q{ Run the specified module against a a given set
|
||||
of sessions or all sessions.},
|
||||
'License' => MSF_LICENSE,
|
||||
'Author' => [ 'Carlos Perez <carlos_perez[at]darkoperator.com>'],
|
||||
'Version' => '$Revision$'
|
||||
))
|
||||
register_options(
|
||||
[
|
||||
OptString.new('SESSIONS', [true, 'Specify either ALL for all sessions or a comman separated list of sessions.', nil]),
|
||||
OptString.new('MODULE', [true, 'Post Module to run', nil]),
|
||||
OptString.new('OPTIONS', [false, 'Commans Separated list of Options for post module', nil]),
|
||||
|
||||
OptString.new('SESSIONS', [true, 'Specify either ALL for all sessions or a comma-separated list of sessions']),
|
||||
OptString.new('MODULE', [true, 'The name of the Post module to run']),
|
||||
OptString.new('OPTIONS', [false, 'Comma-separated list of options for the post module'])
|
||||
], self.class)
|
||||
end
|
||||
|
||||
|
@ -70,9 +69,10 @@ class Metasploit3 < Msf::Post
|
|||
end
|
||||
end
|
||||
else
|
||||
print_error("No Compatible Sessions where found!")
|
||||
print_error("No compatible sessions were found")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -12,20 +12,21 @@
|
|||
require 'msf/core'
|
||||
|
||||
class Metasploit3 < Msf::Post
|
||||
include Msf::Ui::Console
|
||||
|
||||
def initialize(info={})
|
||||
super( update_info( info,
|
||||
'Name' => 'Multi Manage Post Module Resource file Automation',
|
||||
'Description' => %q{ Run resource file with post modules and options
|
||||
against specified sessions.},
|
||||
'Description' => %q{
|
||||
Execute a resource file containing post modules and options
|
||||
against specific sessions.
|
||||
},
|
||||
'License' => MSF_LICENSE,
|
||||
'Author' => [ 'Carlos Perez <carlos_perez[at]darkoperator.com>'],
|
||||
'Version' => '$Revision$'
|
||||
))
|
||||
register_options(
|
||||
[
|
||||
OptString.new('RESOURCE', [true, 'Resource file with space separate values <session> <module> <options>, per line.', nil])
|
||||
|
||||
OptPath.new('RESOURCE', [true, "Resource file with space-separated values in the form of: '<session> <module> <options>'"])
|
||||
], self.class)
|
||||
end
|
||||
|
||||
|
@ -43,7 +44,7 @@ class Metasploit3 < Msf::Post
|
|||
entries << line.chomp
|
||||
end
|
||||
else
|
||||
print_error("Resourse file does not exist.")
|
||||
print_error("Resource file does not exist.")
|
||||
end
|
||||
|
||||
if entries
|
||||
|
@ -55,7 +56,7 @@ class Metasploit3 < Msf::Post
|
|||
else
|
||||
post_mod = values[1]
|
||||
end
|
||||
|
||||
|
||||
if values.length == 3
|
||||
mod_opts = values[2].split(",")
|
||||
end
|
||||
|
@ -70,12 +71,12 @@ class Metasploit3 < Msf::Post
|
|||
session_list.each do |s|
|
||||
next if not current_sessions.include?(s.to_i)
|
||||
if m.session_compatible?(s.to_i)
|
||||
print_status("Running Against #{s}")
|
||||
print_status("Running against #{s}")
|
||||
m.datastore['SESSION'] = s.to_i
|
||||
if mod_opts
|
||||
mod_opts.each do |o|
|
||||
opt_pair = o.split("=",2)
|
||||
print_status("\tSetting Option #{opt_pair[0]} to #{opt_pair[1]}")
|
||||
print_status("\tSetting option #{opt_pair[0]} to #{opt_pair[1]}")
|
||||
m.datastore[opt_pair[0]] = opt_pair[1]
|
||||
end
|
||||
end
|
||||
|
@ -89,11 +90,12 @@ class Metasploit3 < Msf::Post
|
|||
end
|
||||
end
|
||||
else
|
||||
print_error("No Compatible Sessions where found!")
|
||||
print_error("No compatible sessions were found")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue