mirror of
https://github.com/rapid7/metasploit-framework
synced 2024-11-12 11:52:01 +01:00
add -f flag to exploit command to force running despite a conflicting MinimumRank value. fixes 628
git-svn-id: file:///home/svn/framework3/trunk@7770 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
parent
e2f70c8928
commit
961e70fc34
@ -14,6 +14,7 @@ class Exploit
|
||||
|
||||
@@exploit_opts = Rex::Parser::Arguments.new(
|
||||
"-e" => [ true, "The payload encoder to use. If none is specified, ENCODER is used." ],
|
||||
"-f" => [ false, "Force the exploit to run regardless of the value of MinimumRank." ],
|
||||
"-h" => [ false, "Help banner." ],
|
||||
"-j" => [ false, "Run in the context of a job." ],
|
||||
"-n" => [ true, "The NOP generator to use. If none is specified, NOP is used." ],
|
||||
@ -92,6 +93,7 @@ class Exploit
|
||||
nop = mod.datastore['NOP']
|
||||
bg = false
|
||||
jobify = false
|
||||
force = false
|
||||
|
||||
# Always run passive exploits in the background
|
||||
if (mod.passive?)
|
||||
@ -102,6 +104,8 @@ class Exploit
|
||||
case opt
|
||||
when '-e'
|
||||
encoder = val
|
||||
when '-f'
|
||||
force = true
|
||||
when '-j'
|
||||
jobify = true
|
||||
when '-n'
|
||||
@ -123,6 +127,20 @@ class Exploit
|
||||
end
|
||||
}
|
||||
|
||||
minrank = RankingName.invert[framework.datastore['MinimumRank']] || 0
|
||||
if minrank > mod.rank
|
||||
if force
|
||||
print_status("Forcing #{mod.refname} to run despite MinimumRank '#{framework.datastore['MinimumRank']}'")
|
||||
ilog("Forcing #{mod.refname} to run despite MinimumRank '#{framework.datastore['MinimumRank']}'", 'core')
|
||||
else
|
||||
print_error("This exploit is below the minimum rank, '#{framework.datastore['MinimumRank']}'.")
|
||||
print_error("If you really want to run it, do 'exploit -f' or")
|
||||
print_error("setg MinimumRank to something lower ('manual' is")
|
||||
print_error("the lowest and would allow running all exploits).")
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
begin
|
||||
session = mod.exploit_simple(
|
||||
'Encoder' => encoder,
|
||||
|
Loading…
Reference in New Issue
Block a user