Skip to content

Instantly share code, notes, and snippets.

@kernelsmith
Created October 3, 2012 22:14
Show Gist options
  • Save kernelsmith/3830234 to your computer and use it in GitHub Desktop.
Save kernelsmith/3830234 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment