Module: RubySMB::Client::Winreg
- Included in:
- RubySMB::Client
- Defined in:
- lib/ruby_smb/client/winreg.rb
Instance Method Summary collapse
- #connect_to_winreg(host) ⇒ Object
- #enum_registry_key(host, key) ⇒ Object
- #enum_registry_values(host, key) ⇒ Object
- #get_key_security_descriptor(host, key, security_information = RubySMB::Field::SecurityDescriptor::OWNER_SECURITY_INFORMATION) ⇒ Object
- #has_registry_key?(host, key) ⇒ Boolean
- #read_registry_key_value(host, key, value_name) ⇒ Object
- #set_key_security_descriptor(host, key, security_descriptor, security_information = RubySMB::Field::SecurityDescriptor::OWNER_SECURITY_INFORMATION) ⇒ Object
Instance Method Details
#connect_to_winreg(host) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/ruby_smb/client/winreg.rb', line 5 def connect_to_winreg(host) share = "\\\\#{host}\\IPC$" tree = @tree_connects.find {|tree| tree.share == share} tree = tree_connect(share) unless tree named_pipe = tree.open_pipe(filename: "winreg", write: true, read: true) if block_given? res = yield named_pipe named_pipe.close res else named_pipe end end |
#enum_registry_key(host, key) ⇒ Object
31 32 33 34 35 |
# File 'lib/ruby_smb/client/winreg.rb', line 31 def enum_registry_key(host, key) connect_to_winreg(host) do |named_pipe| named_pipe.enum_registry_key(key) end end |
#enum_registry_values(host, key) ⇒ Object
37 38 39 40 41 |
# File 'lib/ruby_smb/client/winreg.rb', line 37 def enum_registry_values(host, key) connect_to_winreg(host) do |named_pipe| named_pipe.enum_registry_values(key) end end |
#get_key_security_descriptor(host, key, security_information = RubySMB::Field::SecurityDescriptor::OWNER_SECURITY_INFORMATION) ⇒ Object
43 44 45 46 47 |
# File 'lib/ruby_smb/client/winreg.rb', line 43 def get_key_security_descriptor(host, key, security_information = RubySMB::Field::SecurityDescriptor::OWNER_SECURITY_INFORMATION) connect_to_winreg(host) do |named_pipe| named_pipe.get_key_security_descriptor(key, security_information) end end |
#has_registry_key?(host, key) ⇒ Boolean
19 20 21 22 23 |
# File 'lib/ruby_smb/client/winreg.rb', line 19 def has_registry_key?(host, key) connect_to_winreg(host) do |named_pipe| named_pipe.has_registry_key?(key) end end |
#read_registry_key_value(host, key, value_name) ⇒ Object
25 26 27 28 29 |
# File 'lib/ruby_smb/client/winreg.rb', line 25 def read_registry_key_value(host, key, value_name) connect_to_winreg(host) do |named_pipe| named_pipe.read_registry_key_value(key, value_name) end end |
#set_key_security_descriptor(host, key, security_descriptor, security_information = RubySMB::Field::SecurityDescriptor::OWNER_SECURITY_INFORMATION) ⇒ Object
49 50 51 52 53 |
# File 'lib/ruby_smb/client/winreg.rb', line 49 def set_key_security_descriptor(host, key, security_descriptor, security_information = RubySMB::Field::SecurityDescriptor::OWNER_SECURITY_INFORMATION) connect_to_winreg(host) do |named_pipe| named_pipe.set_key_security_descriptor(key, security_descriptor, security_information) end end |