Class: Ronin::RPC::PHP::Client

Inherits:
RPC::Client
  • Object
show all
Defined in:
lib/ronin/rpc/php/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, options = {}) ⇒ Client

Creates a new Client object with the specified url and the given options.

options may contain the following keys:

:proxy

The proxy settings to use when communicating with the server.

:user_agent

The User-Agent to send to the server.

:user_agent_alias

The User-Agent alias to send to the server.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/ronin/rpc/php/client.rb', line 65

def initialize(url,options={})
  @url = url

  @proxy = options[:proxy]

  if options[:user_agent_alias]
    @user_agent = Web.user_agent_alias[options[:user_agent_alias]]
  else
    @user_agent = options[:user_agent]
  end

  @cookie = nil
  @session = {}
end

Instance Attribute Details

#proxyObject

Proxy to send requests through



40
41
42
# File 'lib/ronin/rpc/php/client.rb', line 40

def proxy
  @proxy
end

#sessionObject (readonly)

Session data



46
47
48
# File 'lib/ronin/rpc/php/client.rb', line 46

def session
  @session
end

#urlObject (readonly)

URL of RPC server



37
38
39
# File 'lib/ronin/rpc/php/client.rb', line 37

def url
  @url
end

#user_agentObject

User-Agent string to send with each request



43
44
45
# File 'lib/ronin/rpc/php/client.rb', line 43

def user_agent
  @user_agent
end

Instance Method Details

#call_url(call_object) ⇒ Object



80
81
82
83
84
85
# File 'lib/ronin/rpc/php/client.rb', line 80

def call_url(call_object)
  new_url = URI(@url.to_s)
  new_url.query_params['rpc_call'] = call_object.encode(@session)

  return new_url
end

#fingerprintObject

Returns a finger-print of the PHP server.



98
99
100
# File 'lib/ronin/rpc/php/client.rb', line 98

def fingerprint
  call(:fingerprint)
end

#running?Boolean

Returns true if the RPC server is running and responding to function calls, returns false otherwise.

Returns:

  • (Boolean)


91
92
93
# File 'lib/ronin/rpc/php/client.rb', line 91

def running?
  call(:running)
end