merge patch from Larry Wert, fixes #2510
git-svn-id: file:///home/svn/framework3/trunk@10955 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
parent
db602dd478
commit
73d9135c91
|
@ -23,6 +23,10 @@ class Exploit
|
||||||
"-t" => [ true, "The target index to use. If none is specified, TARGET is used." ],
|
"-t" => [ true, "The target index to use. If none is specified, TARGET is used." ],
|
||||||
"-z" => [ false, "Do not interact with the session after successful exploitation." ])
|
"-z" => [ false, "Do not interact with the session after successful exploitation." ])
|
||||||
|
|
||||||
|
@@reload_opts = Rex::Parser::Arguments.new(
|
||||||
|
'-k' => [ false, 'Stop the current job before reloading.' ],
|
||||||
|
'-h' => [ false, 'Help banner.' ])
|
||||||
|
|
||||||
#
|
#
|
||||||
# Returns the hash of exploit module specific commands.
|
# Returns the hash of exploit module specific commands.
|
||||||
#
|
#
|
||||||
|
@ -32,6 +36,7 @@ class Exploit
|
||||||
"exploit" => "Launch an exploit attempt",
|
"exploit" => "Launch an exploit attempt",
|
||||||
"rcheck" => "Reloads the module and checks if the target is vulnerable",
|
"rcheck" => "Reloads the module and checks if the target is vulnerable",
|
||||||
"rexploit" => "Reloads the module and launches an exploit attempt",
|
"rexploit" => "Reloads the module and launches an exploit attempt",
|
||||||
|
"reload" => "Just reloads the module"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -199,29 +204,27 @@ class Exploit
|
||||||
# vulnerable.
|
# vulnerable.
|
||||||
#
|
#
|
||||||
def cmd_rcheck(*args)
|
def cmd_rcheck(*args)
|
||||||
omod = self.mod
|
reload()
|
||||||
self.mod = framework.modules.reload_module(mod)
|
|
||||||
if(not self.mod)
|
|
||||||
print_status("Failed to reload module: #{framework.modules.failed[omod.file_path]}")
|
|
||||||
self.mod = omod
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
self.mod.init_ui(driver.input, driver.output)
|
self.mod.init_ui(driver.input, driver.output)
|
||||||
cmd_check(*args)
|
cmd_check(*args)
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Reloads an exploit module and launches an exploit.
|
# Reload an exploit module, optionally stopping existing job
|
||||||
#
|
#
|
||||||
def cmd_rexploit(*args)
|
def reload(should_stop_job=false)
|
||||||
if mod.job_id
|
|
||||||
print_status("Stopping existing job...")
|
if should_stop_job and mod.job_id
|
||||||
|
print_status('Stopping existing job...')
|
||||||
|
|
||||||
framework.jobs.stop_job(mod.job_id)
|
framework.jobs.stop_job(mod.job_id)
|
||||||
mod.job_id = nil
|
mod.job_id = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
print_status('Reloading module...')
|
||||||
|
|
||||||
omod = self.mod
|
omod = self.mod
|
||||||
self.mod = framework.modules.reload_module(mod)
|
self.mod = framework.modules.reload_module(mod)
|
||||||
|
|
||||||
|
@ -232,7 +235,36 @@ class Exploit
|
||||||
end
|
end
|
||||||
|
|
||||||
self.mod.init_ui(driver.input, driver.output)
|
self.mod.init_ui(driver.input, driver.output)
|
||||||
|
end
|
||||||
|
|
||||||
|
#
|
||||||
|
# Handles the command to reload an exploit module.
|
||||||
|
#
|
||||||
|
def cmd_reload(*args)
|
||||||
|
# By default, do not stop the existing job
|
||||||
|
stop_existing = false
|
||||||
|
|
||||||
|
@@reload_opts.parse(args) { |opt, idx, val|
|
||||||
|
case opt
|
||||||
|
when '-k'
|
||||||
|
stop_existing = true
|
||||||
|
when '-h'
|
||||||
|
print_line "Usage: reload [-k]\n\nReloads the current module."
|
||||||
|
print_line @@reload_opts.usage
|
||||||
|
return
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
reload(stop_existing)
|
||||||
|
end
|
||||||
|
|
||||||
|
#
|
||||||
|
# Reloads an exploit module and launches an exploit.
|
||||||
|
#
|
||||||
|
def cmd_rexploit(*args)
|
||||||
|
# Stop existing job and reload the module
|
||||||
|
reload(true)
|
||||||
|
# Delegate to the exploit command
|
||||||
cmd_exploit(*args)
|
cmd_exploit(*args)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue