more info about a job, thanks Ryan Linn for the patch; fixes #586
git-svn-id: file:///home/svn/framework3/trunk@7665 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
25106b555f
commit
0da80965d6
|
@ -22,6 +22,16 @@ class Job < Base
|
|||
{ "result" => "success" }
|
||||
end
|
||||
end
|
||||
def info(token,jid)
|
||||
authenticate(token)
|
||||
obj = @framework.jobs[jid.to_s]
|
||||
if(not obj)
|
||||
raise ::XMLRPC::FaultException.new(404, "no such job")
|
||||
else
|
||||
info = obj.info
|
||||
{ "result" => "success" , "info" => info}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -34,6 +34,7 @@ class Core
|
|||
"-h" => [ false, "Help banner." ],
|
||||
"-k" => [ true, "Terminate the specified job name." ],
|
||||
"-K" => [ false, "Terminate all running jobs." ],
|
||||
"-i" => [ true, "Lists information about a running job." ],
|
||||
"-l" => [ false, "List all running jobs." ])
|
||||
|
||||
@@persist_opts = Rex::Parser::Arguments.new(
|
||||
|
@ -539,7 +540,33 @@ class Core
|
|||
framework.jobs.each_key do |i|
|
||||
framework.jobs.stop_job(i)
|
||||
end
|
||||
when "-i"
|
||||
if (framework.jobs[val.to_s])
|
||||
name = framework.jobs[val.to_s].name
|
||||
info = framework.jobs[val.to_s].info
|
||||
mod_name = name.split(": ")[1]
|
||||
|
||||
if ((mod = framework.modules.create(mod_name)) == nil)
|
||||
print_error("Failed to load module: #{mod_name}")
|
||||
return false
|
||||
end
|
||||
|
||||
info["datastore"].each { |key,val|
|
||||
mod.datastore[key] = val
|
||||
}
|
||||
output = "\n"
|
||||
output += "Name: #{mod.name}\n"
|
||||
print_line(output)
|
||||
|
||||
if (mod.options.has_options?)
|
||||
show_options(mod)
|
||||
end
|
||||
|
||||
mod_opt = Serializer::ReadableText.dump_advanced_options(mod,' ')
|
||||
print_line("\nModule advanced options:\n\n#{mod_opt}\n") if (mod_opt and mod_opt.length > 0)
|
||||
else
|
||||
print_line("Invalid Job ID")
|
||||
end
|
||||
when "-h"
|
||||
print(
|
||||
"Usage: jobs [options]\n\n" +
|
||||
|
|
|
@ -59,6 +59,28 @@ class Job
|
|||
clean_proc.call(ctx) if (clean_proc)
|
||||
end
|
||||
|
||||
#
|
||||
# Surfaces the setings from the job to determine the current settings
|
||||
#
|
||||
def info
|
||||
ret = {}
|
||||
con = nil
|
||||
ret['jid'] = self.jid
|
||||
ret['name'] = self.name
|
||||
if(self.ctx.class == Array)
|
||||
con = self.ctx[0]
|
||||
|
||||
else
|
||||
con = self.ctx
|
||||
end
|
||||
ret['datastore'] = con.datastore
|
||||
if(con.kind_of? Msf::Exploit::Remote::HttpServer)
|
||||
|
||||
ret['datastore']['URIPATH'] = con.get_resource()
|
||||
end
|
||||
ret
|
||||
end
|
||||
|
||||
#
|
||||
# The name of the job.
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue