1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-10-09 04:26:11 +02:00

new parameter

This commit is contained in:
m-1-k-3 2012-07-10 20:04:03 +02:00
parent 5b526de09d
commit b449c0e21c

View File

@ -13,7 +13,7 @@ def help_me
default to a suitable meterpreter.
Usage:
./msfconsole -r [rc_path] [db_user] [db_pass] [db_workspace] [module_path] [dry] [check]
./msfconsole -r [rc_path] [db_user] [db_pass] [db_workspace] [module_path] [mode]
Arguments:
rc_path - Full path to the RC script
@ -21,11 +21,10 @@ def help_me
db_pass - Password for MSF database (datastore: 'DB_PASS')
db_worksapce - Workspace for the database (datastore: 'DB_WORKSPACE')
module_path - Path to the exploit (datastore: 'MODULE')
dry - Optional. Dry-run mode [yes/no] (datastore: 'DRY')
check - Optional. Check mode [yes/no] (datastore: 'CHECK')
mode - Optional. Dry-run mode [dry/check] (datastore: 'MODE')
Example:
msfconsole -r autoexploit.rc username password msf windows/smb/ms08_067_netapi
msfconsole -r autoexploit.rc username password msf windows/smb/ms08_067_netapi dry
Authors:
sinn3r <sinn3r[at]metasploit.com>
@ -149,7 +148,7 @@ end
#
# Find all mathing references
#
def dry_run(module_path,check)
def dry_run(module_path,mode)
exploit = load_exploit(module_path)
raise RuntimeError, "Exploit not found: #{module_path}" if exploit.nil?
@ -159,7 +158,7 @@ def dry_run(module_path,check)
next if not ref_has_match(vuln.refs, exploit_refs)
addr = vuln.host.address.to_s
print_good("#{addr} seems vulnerable to #{exploit.shortname}")
if check == true
if mode == "check"
print_good("checking #{addr} with check mechanism of #{exploit.shortname}")
run_single("use #{exploit.fullname}")
run_single("set RHOST #{addr}")
@ -199,8 +198,7 @@ def init_args
args[:db_pass] = ARGV.shift || datastore['DB_PASS'] || ''
args[:db_workspace] = ARGV.shift || datastore['DB_WORKSPACE'] || ''
args[:module] = ARGV.shift || datastore['MODULE'] || ''
args[:dry] = (ARGV.shift || datastore['DRY']) =~ /^yes$/i ? true : false
args[:check] = (ARGV.shift || datastore['CHECK']) =~ /^yes$/i ? true : false
args[:mode] = (ARGV.shift || datastore['MODE'] || '')
raise ArgumentError, "Missing a module path" if args[:module].empty?
@ -225,10 +223,8 @@ begin
end
end
if args[:dry]
dry_run(args[:module], args[:check])
elsif args[:check]
dry_run(args[:module], args[:check])
if (args[:mode] == "dry" or args[:mode] == "check")
dry_run(args[:module], args[:mode])
else
auto_exploit(args[:module])
end