2011-03-22 23:04:41 +00:00
|
|
|
##
|
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# ## This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/framework/
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
require 'rex'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Post
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def initialize(info={})
|
|
|
|
super( update_info( info,
|
2011-04-27 16:25:15 +00:00
|
|
|
'Name' => 'Multi Gather Run Console Resource File',
|
2011-03-22 23:04:41 +00:00
|
|
|
'Description' => %q{ This module will read console commands from a resource file and
|
2011-07-27 02:39:49 +00:00
|
|
|
execute the commands in the specified Meterpreter session.},
|
2011-03-22 23:04:41 +00:00
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Author' => [ 'Carlos Perez <carlos_perez[at]darkoperator.com>'],
|
|
|
|
'Version' => '$Revision$',
|
|
|
|
'Platform' => [ 'windows' ],
|
|
|
|
'SessionTypes' => [ 'meterpreter' ]
|
|
|
|
))
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
|
|
|
|
OptString.new('RESOURCE', [true, 'Full path to resource file to read commands from.', nil]),
|
|
|
|
|
|
|
|
|
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
|
|
|
# Run Method for when run command is issued
|
|
|
|
def run
|
|
|
|
print_status("Running module against #{sysinfo['Computer']}")
|
|
|
|
if not ::File.exists?(datastore['RESOURCE'])
|
2011-06-10 03:36:48 +00:00
|
|
|
raise "Resource File does not exists!"
|
|
|
|
else
|
|
|
|
::File.open(datastore['RESOURCE'], "r").each_line do |cmd|
|
|
|
|
next if cmd.strip.length < 1
|
2011-03-22 23:04:41 +00:00
|
|
|
next if cmd[0,1] == "#"
|
|
|
|
begin
|
|
|
|
print_status "Running command #{cmd.chomp}"
|
|
|
|
session.console.run_single(cmd.chomp)
|
|
|
|
rescue ::Exception => e
|
|
|
|
print_status("Error Running Command #{cmd.chomp}: #{e.class} #{e}")
|
|
|
|
end
|
2011-06-10 03:36:48 +00:00
|
|
|
end
|
|
|
|
end
|
2011-03-22 23:04:41 +00:00
|
|
|
end
|
2011-07-27 02:39:49 +00:00
|
|
|
end
|