Class: Rex::Post::Meterpreter::Extensions::Stdapi::Sys::RegistrySubsystem::RegistryValue
- Inherits:
-
Object
- Object
- Rex::Post::Meterpreter::Extensions::Stdapi::Sys::RegistrySubsystem::RegistryValue
- Defined in:
- lib/rex/post/meterpreter/extensions/stdapi/sys/registry_subsystem/registry_value.rb
Overview
Class wrapper around a logical registry value on the remote side.
Instance Attribute Summary collapse
-
#client ⇒ Object
protected
:nodoc:.
-
#data ⇒ Object
The arbitrary data stored within the value, if any.
-
#hkey ⇒ Object
The remote server key handle.
-
#name ⇒ Object
The name of the registry value.
-
#type ⇒ Object
The type of data represented by the registry value.
Instance Method Summary collapse
-
#delete ⇒ Object
Deletes the value.
-
#initialize(client, hkey, name, type = nil, data = nil) ⇒ RegistryValue
constructor
Initializes a registry value instance that’s associated with the supplied server key handle.
-
#query ⇒ Object
Queries the value’s data.
-
#set(data, type = nil) ⇒ Object
Sets the value’s data.
- #type_to_s ⇒ Object
Constructor Details
#initialize(client, hkey, name, type = nil, data = nil) ⇒ RegistryValue
Initializes a registry value instance that’s associated with the supplied server key handle.
25 26 27 28 29 30 31 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/sys/registry_subsystem/registry_value.rb', line 25 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 |
Instance Attribute Details
#client ⇒ Object (protected)
:nodoc:
99 100 101 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/sys/registry_subsystem/registry_value.rb', line 99 def client @client end |
#data ⇒ Object
The arbitrary data stored within the value, if any.
97 98 99 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/sys/registry_subsystem/registry_value.rb', line 97 def data @data end |
#hkey ⇒ Object
The remote server key handle.
85 86 87 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/sys/registry_subsystem/registry_value.rb', line 85 def hkey @hkey end |
#name ⇒ Object
The name of the registry value.
89 90 91 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/sys/registry_subsystem/registry_value.rb', line 89 def name @name end |
#type ⇒ Object
The type of data represented by the registry value.
93 94 95 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/sys/registry_subsystem/registry_value.rb', line 93 def type @type end |
Instance Method Details
#delete ⇒ Object
Deletes the value.
68 69 70 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/sys/registry_subsystem/registry_value.rb', line 68 def delete() return self.client.sys.registry.delete_value(self.hkey, self.name) end |
#query ⇒ Object
Queries the value’s data.
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/sys/registry_subsystem/registry_value.rb', line 54 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) ⇒ Object
Sets the value’s data.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/sys/registry_subsystem/registry_value.rb', line 36 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 ⇒ Object
72 73 74 75 76 77 78 79 80 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/sys/registry_subsystem/registry_value.rb', line 72 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 "REG_MULTI_SZ" if (type == REG_MULTI_SZ) return nil end |