class Rex::Post::Meterpreter::Extensions::Stdapi::Sys::RegistrySubsystem::RegistryValue

Class wrapper around a logical registry value on the remote side.

Attributes

data[R]

The arbitrary data stored within the value, if any.

hkey[R]

The remote server key handle.

name[R]

The name of the registry value.

type[R]

The type of data represented by the registry value.

Public Class Methods

new(client, hkey, name, type = nil, data = nil) click to toggle source

Initializes a registry value instance that’s associated with the supplied server key handle.

# File lib/rex/post/meterpreter/extensions/stdapi/sys/registry_subsystem/registry_value.rb, line 24
def initialize(client, hkey, name, type = nil, data = nil)
  self.client = client
  self.hkey   = hkey
  self.name   = name
  self.type   = type
  self.data   = data
end

Public Instance Methods

delete() click to toggle source

Deletes the value.

# File lib/rex/post/meterpreter/extensions/stdapi/sys/registry_subsystem/registry_value.rb, line 67
def delete()
  return self.client.sys.registry.delete_value(self.hkey, self.name)
end
query() click to toggle source

Queries the value’s data.

# File lib/rex/post/meterpreter/extensions/stdapi/sys/registry_subsystem/registry_value.rb, line 53
def query()
  val =  self.client.sys.registry.query_value(self.hkey, self.name)

  if (val != nil)
    self.data = val.data
    self.type = val.type
  end

  return self.data
end
set(data, type = nil) click to toggle source

Sets the value’s data.

# File lib/rex/post/meterpreter/extensions/stdapi/sys/registry_subsystem/registry_value.rb, line 35
def set(data, type = nil)
  if (type == nil)
    type = self.type
  end
  if (self.client.sys.registry.set_value(self.hkey, self.name,
      type, data))
    self.data = data
    self.type = type

    return true
  end

  return false
end
type_to_s() click to toggle source
# File lib/rex/post/meterpreter/extensions/stdapi/sys/registry_subsystem/registry_value.rb, line 71
def type_to_s
  return "REG_SZ" if (type == REG_SZ)
  return "REG_DWORD" if (type == REG_DWORD)
  return "REG_BINARY" if (type == REG_BINARY)
  return "REG_EXPAND_SZ" if (type == REG_EXPAND_SZ)
  return "REG_NONE" if (type == REG_NONE)
  return nil
end