Module: Msf::RPC::JSON::DispatcherHelper

Defined in:
lib/msf/core/rpc/json/dispatcher_helper.rb

Instance Method Summary collapse

Instance Method Details

#create_dispatcher(version, framework) ⇒ Object

Create an RPC Dispatcher composed of an RpcCommand for the provided version.

Parameters:


23
24
25
26
27
28
29
# File 'lib/msf/core/rpc/json/dispatcher_helper.rb', line 23

def create_dispatcher(version, framework)
  command = RpcCommandFactory.create(version, framework)
  dispatcher = Dispatcher.new(framework)
  dispatcher.set_command(command)

  dispatcher
end

#get_dispatcher(dispatchers, version, framework) ⇒ Object

Get an RPC Dispatcher for the RPC version. Creates a new instance and stores it in the dispatchers hash if one does not already exist for the version.

Parameters:

  • dispatchers (Hash)

    hash of version Symbol - Msf::RPC::JSON::Dispatcher object pairs

  • version (Symbol)

    the RPC version

  • framework (Msf::Simple::Framework)

    Framework wrapper instance


11
12
13
14
15
16
17
# File 'lib/msf/core/rpc/json/dispatcher_helper.rb', line 11

def get_dispatcher(dispatchers, version, framework)
  unless dispatchers.key?(version)
    dispatchers[version] = create_dispatcher(version, framework)
  end

  dispatchers[version]
end