Class: Msf::RPC::RPC_Core

Inherits:
RPC_Base show all
Defined in:
lib/msf/core/rpc/v10/rpc_core.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_add_module_path(path) ⇒ Object


38
39
40
41
# File 'lib/msf/core/rpc/v10/rpc_core.rb', line 38

def rpc_add_module_path(path)
  framework.modules.add_module_path(path)
  rpc_module_stats()
end

#rpc_module_statsObject


43
44
45
46
47
48
49
50
51
52
# File 'lib/msf/core/rpc/v10/rpc_core.rb', line 43

def rpc_module_stats
  {
    'exploits'  => framework.stats.num_exploits,
    'auxiliary' => framework.stats.num_auxiliary,
    'post'      => framework.stats.num_post,
    'encoders'  => framework.stats.num_encoders,
    'nops'      => framework.stats.num_nops,
    'payloads'  => framework.stats.num_payloads
  }
end

#rpc_reload_modulesObject


33
34
35
36
# File 'lib/msf/core/rpc/v10/rpc_core.rb', line 33

def rpc_reload_modules
  framework.modules.reload_modules
  rpc_module_stats()
end

#rpc_saveObject


28
29
30
31
# File 'lib/msf/core/rpc/v10/rpc_core.rb', line 28

def rpc_save
  framework.save_config
  { "result" => "success" }
end

#rpc_setg(var, val) ⇒ Object


18
19
20
21
# File 'lib/msf/core/rpc/v10/rpc_core.rb', line 18

def rpc_setg(var, val)
  framework.datastore[var] = val
  { "result" => "success" }
end

#rpc_stopObject


14
15
16
# File 'lib/msf/core/rpc/v10/rpc_core.rb', line 14

def rpc_stop
  self.service.stop
end

#rpc_thread_kill(tid) ⇒ Object


69
70
71
72
# File 'lib/msf/core/rpc/v10/rpc_core.rb', line 69

def rpc_thread_kill(tid)
  framework.threads.kill(tid.to_i) rescue nil
  { "result" => "success" }
end

#rpc_thread_listObject


54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/msf/core/rpc/v10/rpc_core.rb', line 54

def rpc_thread_list
  res = {}
  framework.threads.each_index do |i|
    t = framework.threads[i]
    next if not t
    res[i] = {
      :status   => (t.status || "dead"),
      :critical => t[:tm_crit] ? true : false,
      :name     => t[:tm_name].to_s,
      :started  => t[:tm_time].to_s
    }
  end
  res
end

#rpc_unsetg(var) ⇒ Object


23
24
25
26
# File 'lib/msf/core/rpc/v10/rpc_core.rb', line 23

def rpc_unsetg(var)
  framework.datastore.delete(var)
  { "result" => "success" }
end

#rpc_versionObject


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

def rpc_version
  {
    "version" => ::Msf::Framework::Version,
    "ruby"    => "#{RUBY_VERSION} #{RUBY_PLATFORM} #{RUBY_RELEASE_DATE}",
    "api"     => API_VERSION
  }
end