Class: Msf::RPC::RPC_Job
- Defined in:
- lib/msf/core/rpc/v10/rpc_job.rb
Instance Attribute Summary
Attributes inherited from RPC_Base
#framework, #job_status_tracker, #service, #tokens, #users
Instance Method Summary collapse
-
#rpc_info(jid) ⇒ Hash
Returns information about a job.
-
#rpc_list ⇒ Hash
Returns a list of jobs.
-
#rpc_stop(jid) ⇒ Hash
Stops a job.
Methods inherited from RPC_Base
Constructor Details
This class inherits a constructor from Msf::RPC::RPC_Base
Instance Method Details
#rpc_info(jid) ⇒ Hash
Returns information about a job.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/msf/core/rpc/v10/rpc_job.rb', line 49 def rpc_info(jid) obj = self.framework.jobs[jid.to_s] error(500, "Invalid Job") if not obj info = { :jid => obj.jid, :name => obj.name, :start_time => obj.start_time.to_i } if obj.ctx && obj.ctx[0] if obj.ctx[0].respond_to?(:get_resource) info[:uripath] = obj.ctx[0].get_resource end if obj.ctx[0].respond_to?(:datastore) info[:datastore] = obj.ctx[0].datastore.to_h end end info end |
#rpc_list ⇒ Hash
Returns a list of jobs.
14 15 16 17 18 19 20 |
# File 'lib/msf/core/rpc/v10/rpc_job.rb', line 14 def rpc_list res = {} self.framework.jobs.each do |j| res[j[0]] = j[1].name end res end |
#rpc_stop(jid) ⇒ Hash
Stops a job.
30 31 32 33 34 35 36 |
# File 'lib/msf/core/rpc/v10/rpc_job.rb', line 30 def rpc_stop(jid) jid = jid.to_s obj = self.framework.jobs[jid] error(500, "Invalid Job") if not obj self.framework.jobs.stop_job(jid) { "result" => "success" } end |