added check

git-svn-id: file:///home/svn/incoming/trunk@2756 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Matt Miller 2005-07-14 20:36:34 +00:00
parent 91e8ca14d1
commit 17b00814c6
4 changed files with 51 additions and 7 deletions

View File

@ -5,19 +5,20 @@ module CommandDispatcher
class Exploit
include Msf::Ui::Console::ModuleCommandDispatcher
@@exploit_opts = Rex::Parser::Arguments.new(
"-e" => [ true, "The payload encoder to use. If none is specified, ENCODER is used." ],
"-h" => [ false, "Help banner." ],
"-n" => [ true, "The NOP generator to use. If none is specified, NOP is used." ],
"-o" => [ true, "A comma separated list of options in VAR=VAL format." ],
"-p" => [ true, "The payload to use. If none is specified, PAYLOAD is used." ],
"-t" => [ true, "The target index to use." ],
"-t" => [ true, "The target index to use. If none is specified, TARGET is used." ],
"-z" => [ true, "Do not interact with the session after successful exploitation." ])
include Msf::Ui::Console::ModuleCommandDispatcher
def commands
{
"check" => "Check to see if a target is vulnerable",
"exploit" => "Launch an exploit attempt",
}
end
@ -26,10 +27,49 @@ class Exploit
"Exploit"
end
#
# Checks to see if a target is vulnerable
#
def cmd_check(*args)
begin
code = mod.check
if (code)
stat = '[*]'
if (code == Msf::Exploit::CheckCode::Vulnerable)
stat = '[+]'
end
print_line(stat + ' ' + code[1])
else
print_error(
"Check failed: The state could not be determined.")
end
rescue
log_error("Check failed: #{$!}.")
end
end
#
# Launches an exploitation attempt
#
def cmd_exploit(*args)
payload = mod.datastore['PAYLOAD']
encoder = mod.datastore['ENCODER']
target = mod.datastore['TARGET']
nop = mod.datastore['NOP']
@@exploit_opts.parse(args) { |opt, idx, val|
case opt
when '-h'
print(
"Usage: exploit [options]\n\n" +
"Launches an exploitation attempt.\n" +
@@exploit_opts.usage)
return false
end
}
end
end

View File

@ -7,13 +7,13 @@ module CommandDispatcher
class Nop
include Msf::Ui::Console::ModuleCommandDispatcher
@@generate_opts = Rex::Parser::Arguments.new(
"-b" => [ true, "The list of characters to avoid: '\\x00\\xff'" ],
"-h" => [ false, "Help banner." ],
"-t" => [ true, "The output type: ruby, perl, c, or raw." ])
include Msf::Ui::Console::ModuleCommandDispatcher
def commands
{
"generate" => "Generates a NOP sled",

View File

@ -7,6 +7,8 @@ module CommandDispatcher
class Payload
include Msf::Ui::Console::ModuleCommandDispatcher
@@generate_opts = Rex::Parser::Arguments.new(
"-b" => [ true, "The list of characters to avoid: '\\x00\\xff'" ],
"-e" => [ true, "The name of the encoder module to use." ],
@ -15,8 +17,6 @@ class Payload
"-s" => [ true, "NOP sled length." ],
"-t" => [ true, "The output type: ruby, perl, c, or raw." ])
include Msf::Ui::Console::ModuleCommandDispatcher
def commands
{
"generate" => "Generates a payload",

View File

@ -31,6 +31,10 @@ class Exploits::Test::Multi::Aggressive < Msf::Exploit::Remote
'DefaultTarget' => 0))
end
def check
return Exploit::CheckCode::Vulnerable
end
def exploit
end