From 961e70fc34d325f07a283d78bc2d446a560966b7 Mon Sep 17 00:00:00 2001 From: James Lee Date: Wed, 9 Dec 2009 02:49:27 +0000 Subject: [PATCH] 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 --- .../ui/console/command_dispatcher/exploit.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/msf/ui/console/command_dispatcher/exploit.rb b/lib/msf/ui/console/command_dispatcher/exploit.rb index 226652393d..2d791adf34 100644 --- a/lib/msf/ui/console/command_dispatcher/exploit.rb +++ b/lib/msf/ui/console/command_dispatcher/exploit.rb @@ -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,