A packet parsing and manipulation library for the SMB2 protocol.
See Microsoft's [MS-SMB2]
It supports authentication via NTLM using the ruby ntlm gem
This gem has not yet been released, but when it is, do this:
Add this line to your application's Gemfile:
gem 'smb2'
And then execute:
$ bundle
Or install it yourself as:
$ gem install smb2
sock = TCPSocket.new("192.168.100.140", 445)
c = Smb2::Client.new(
socket: sock,
username:"administrator",
password:"P@ssword1",
domain:"asdfasdf"
)
c.negotiate
c.authenticate
sock = TCPSocket.new("192.168.100.140", 445)
neg = Smb2::Packet::NegotiateRequest.new(
# This is necessary until I can figure out how to set a default for
# `rest` fields
dialects: "\x02\x02".force_encoding("binary"),
)
nbss = [neg.length].pack("N")
sock.write(nbss + neg.to_s)
# Grab NBSS size
size = sock.read(4).unpack("N").first
data = sock.read(size)
neg_response = Smb2::Packet::NegotiateResponse.new(data)
- Fork it ( https://github.com/jlee-r7/smb2/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request