Module: Ronin::Payloads::Helpers::Rpc

Defined in:
lib/ronin/payloads/helpers/rpc.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *arguments, &block) ⇒ Object (protected)

Provides transparent access to remote methods using the specified name and given arguments.

Since:

  • 0.3.0



81
82
83
84
85
86
87
88
89
# File 'lib/ronin/payloads/helpers/rpc.rb', line 81

def method_missing(name,*arguments,&block)
  name = name.to_s

  if (name[-1..-1] != '=' && block.nil?)
    return call_method(name,*arguments)
  end

  return super(name,*arguments,&block)
end

Instance Method Details

#call_method(method, *arguments) ⇒ Object

Calls a specific method with additional arguments.

Parameters:

  • method (Symbol, String)

    The method name to call.

  • arguments (Array)

    The arguments to use when calling the method.

Returns:

  • (Object)

    The result of the method call.

Raises:

Since:

  • 0.3.0



42
43
44
# File 'lib/ronin/payloads/helpers/rpc.rb', line 42

def call_method(method,*arguments)
  raise(NotImplemented,"the call method is unimplemented",caller)
end

#eval(code) ⇒ Object

Evaluates code.

Parameters:

  • code (String)

    The code to evaluate.

Returns:

  • (Object)

    The result of the code evaluation.

Since:

  • 0.3.0



57
58
59
# File 'lib/ronin/payloads/helpers/rpc.rb', line 57

def eval(code)
  call_method(:eval,code)
end

#exit(status = 0) ⇒ Object

Exits the process.

Parameters:

  • status (Integer) (defaults to: 0)

    The status to exit with.

Since:

  • 0.3.0



69
70
71
# File 'lib/ronin/payloads/helpers/rpc.rb', line 69

def exit(status=0)
  call_method(:exit,status)
end