Sha256: 22336389045c1699623d3f9c891148201635a0335fcdd57c686ecc2f1e94d95d

Contents?: true

Size: 735 Bytes

Versions: 4

Compression:

Stored size: 735 Bytes

Contents

#!/usr/bin/ruby

# This script tests a full Authentication/Session Setup cycle
# including protocol negotiation and authentication.

require 'bundler/setup'
require 'ruby_smb'


def run_authentication(address, smb1, smb2, username, password)
  # Create our socket and add it to the dispatcher
  sock = TCPSocket.new address, 445
  dispatcher = RubySMB::Dispatcher::Socket.new(sock)

  client = RubySMB::Client.new(dispatcher, smb1: smb1, smb2: smb2, username: username, password: password)
  protocol = client.negotiate
  status  = client.authenticate
  puts "#{protocol} : #{status}"
end

address  = ARGV[0]
username = ''
password = ''

# Negotiate with only SMB1 enabled
run_authentication(address, true, false, username, password)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby_smb-0.0.18 examples/anonymous_auth.rb
ruby_smb-0.0.17 examples/anonymous_auth.rb
ruby_smb-0.0.16 examples/anonymous_auth.rb
ruby_smb-0.0.15 examples/anonymous_auth.rb