Class: Msf::RPC::JSON::RpcCommandFactory
- Inherits:
-
Object
- Object
- Msf::RPC::JSON::RpcCommandFactory
- Defined in:
- lib/msf/core/rpc/json/rpc_command_factory.rb
Class Method Summary collapse
-
.create(version, framework) ⇒ RpcCommand
Create an RpcCommand for the provided version.
-
.create_rpc_command_v2_0(framework) ⇒ RpcCommand
Creates an RpcCommand for a demonstration RPC version 2.0.
Class Method Details
.create(version, framework) ⇒ RpcCommand
Create an RpcCommand for the provided version.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/msf/core/rpc/json/rpc_command_factory.rb', line 11 def self.create(version, framework) case version when :v1, :v1_0, :v10 return Msf::RPC::JSON::V1_0::RpcCommand.new(framework) when :v2, :v2_0 return RpcCommandFactory.create_rpc_command_v2_0(framework) else raise ArgumentError.new("invalid RPC version #{version}") end end |
.create_rpc_command_v2_0(framework) ⇒ RpcCommand
Creates an RpcCommand for a demonstration RPC version 2.0.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/msf/core/rpc/json/rpc_command_factory.rb', line 25 def self.create_rpc_command_v2_0(framework) # TODO: does belong in some sort of loader class for an RPC version? # instantiate receiver rpc_test = Msf::RPC::JSON::V2_0::RpcTest.new() command = Msf::RPC::JSON::RpcCommand.new(framework) # Add class methods command.register_method(Msf::RPC::JSON::V2_0::RpcTest.method(:add)) command.register_method(Msf::RPC::JSON::V2_0::RpcTest.method(:add), name: 'add_alias') # Add instance methods command.register_method(rpc_test.method(:get_instance_rand_num)) command.register_method(rpc_test.method(:add_instance_rand_num)) command end |