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) ⇒ Msf::RPC::JSON::Dispatcher

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

Parameters:

Returns:



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

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) ⇒ Msf::RPC::JSON::Dispatcher

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

Returns:



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

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

  dispatchers[version]
end