kernelsmith
10/3/2012 - 10:14 PM

Validate a datastore option AFTER run/exploit

Validate a datastore option AFTER run/exploit

#Validate a datastore option AFTER run/exploit, in case it has changed or whatever

require 'msf/core'

class Metasploit3 < Msf::Auxiliary

	def initialize(info = {})
		super(update_info(info,
			'Name'           => 'opt_check',
			'Description'    => %q{
					Tests something
			},
			'License'        => MSF_LICENSE,
			'Author'         =>  ['yermom'],
			'Version'        => '$Revision$'
		))
			register_options(
				[
					OptPath.new('FILE', [true, "A local file",'msfconsole']),
					OptBool.new('BOOLY', [true, "just any ol bool", true])
				], self.class)
	end

	def run
		print_status "re-validating FILE"
		print_status "#{options['FILE'].valid?(datastore['FILE']).to_s}"
		print_status "re-validating BOOLY"
		print_status "#{options['BOOLY'].valid?(datastore['BOOLY']).to_s}"
	end
end


#produces:
#msf  auxiliary(opt_check) > run

#[*] re-validating FILE
#[*] true
#[*] re-validating BOOLY
#[*] true
#[*] Auxiliary module execution completed