Sha256: b18a8f7936c41fd586a3c453d3df03ea61565505e5d7b1adce7c7077f88c2bb0

Contents?: true

Size: 944 Bytes

Versions: 4

Compression:

Stored size: 944 Bytes

Contents

#!/usr/bin/ruby

# This example script is used for testing Winreg registry key enumeration functionality
# It will attempt to connect to a host and enumerate registry subkeys of a specified registry key.
# Example usage: ruby enum_registry_key.rb 192.168.172.138 msfadmin msfadmin HKLM\\My\\Key
# This will try to connect to \\192.168.172.138 with the msfadmin:msfadmin credentialas and enumerate HKLM\\My\\Key subkeys.

require 'bundler/setup'
require 'ruby_smb'

address  = ARGV[0]
username = ARGV[1]
password = ARGV[2]
registry_key = ARGV[3]

sock = TCPSocket.new address, 445
dispatcher = RubySMB::Dispatcher::Socket.new(sock, read_timeout: 60)

client = RubySMB::Client.new(dispatcher, smb1: true, smb2: true, username: username, password: password)
protocol = client.negotiate
status = client.authenticate

puts "#{protocol} : #{status}"

enum_result = client.enum_registry_key(address, registry_key)
puts enum_result

client.disconnect!

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby_smb-2.0.2 examples/enum_registry_key.rb
ruby_smb-2.0.1 examples/enum_registry_key.rb
ruby_smb-2.0.0 examples/enum_registry_key.rb
ruby_smb-1.1.0 examples/enum_registry_key.rb