Class: Msf::RPC::RPC_Job

Inherits:
RPC_Base show all
Defined in:
lib/msf/core/rpc/v10/rpc_job.rb

Instance Attribute Summary

Attributes inherited from RPC_Base

#framework, #service, #tokens, #users

Instance Method Summary collapse

Methods inherited from RPC_Base

#error, #initialize

Constructor Details

This class inherits a constructor from Msf::RPC::RPC_Base

Instance Method Details

#rpc_info(jid) ⇒ Object


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/msf/core/rpc/v10/rpc_job.rb', line 21

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
    end
  end

  info
end

#rpc_listObject


6
7
8
9
10
11
12
# File 'lib/msf/core/rpc/v10/rpc_job.rb', line 6

def rpc_list
  res = {}
  self.framework.jobs.each do |j|
    res[j[0]] = j[1].name
  end
  res
end

#rpc_stop(jid) ⇒ Object


14
15
16
17
18
19
# File 'lib/msf/core/rpc/v10/rpc_job.rb', line 14

def rpc_stop(jid)
  obj = self.framework.jobs[jid.to_s]
  error(500, "Invalid Job") if not obj
  obj.stop
  { "result" => "success" }
end