Class: Rexpro::Session

Inherits:
Object
  • Object
show all
Defined in:
lib/rexpro/session.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, uuid, languages = nil) ⇒ Session

Returns a new instance of Session.



6
7
8
# File 'lib/rexpro/session.rb', line 6

def initialize(client, uuid, languages = nil)
  @client, @uuid, @languages = client, uuid, languages
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



4
5
6
# File 'lib/rexpro/session.rb', line 4

def client
  @client
end

#languagesObject (readonly)

Returns the value of attribute languages.



4
5
6
# File 'lib/rexpro/session.rb', line 4

def languages
  @languages
end

#uuidObject (readonly)

Returns the value of attribute uuid.



4
5
6
# File 'lib/rexpro/session.rb', line 4

def uuid
  @uuid
end

Instance Method Details

#execute(script, attrs = {}) ⇒ Object



16
17
18
19
20
21
# File 'lib/rexpro/session.rb', line 16

def execute(script, attrs = {})
  attrs = attrs.merge(
    session_uuid: uuid, in_session: true, script: script)
  msg = Rexpro::Message::ScriptRequest.new(attrs)
  client.request(msg)
end

#killObject



10
11
12
13
14
# File 'lib/rexpro/session.rb', line 10

def kill
  attrs = {session_uuid: uuid, kill_session: true}
  msg = Rexpro::Message::SessionRequest.new(attrs)
  client.request(msg)
end