2005-09-22 09:04:54 +00:00
|
|
|
module Rex
|
|
|
|
module Proto
|
|
|
|
module SMB
|
|
|
|
module Exceptions
|
|
|
|
|
|
|
|
|
|
|
|
class Error < ::RuntimeError
|
|
|
|
|
|
|
|
def initialize(*args)
|
|
|
|
super(*args)
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2005-10-03 13:51:05 +00:00
|
|
|
class NoReply < Error
|
|
|
|
def to_s
|
|
|
|
"The SMB server did not reply to our request"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2005-09-22 09:04:54 +00:00
|
|
|
class ReadHeader < Error
|
|
|
|
def to_s
|
|
|
|
"The SMB response header was invalid"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class ReadPacket < Error
|
|
|
|
def to_s
|
|
|
|
"The SMB response packet was invalid"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class WritePacket < Error
|
|
|
|
def to_s
|
|
|
|
"The SMB packet failed to send"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2005-09-23 09:14:03 +00:00
|
|
|
class UnknownDialect < Error
|
|
|
|
def to_s
|
|
|
|
"The server uses an unsupported SMB dialect"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2005-09-23 03:43:04 +00:00
|
|
|
class InvalidPacket < Error
|
|
|
|
attr_accessor :word_count
|
|
|
|
attr_accessor :command
|
|
|
|
attr_accessor :error_code
|
|
|
|
end
|
|
|
|
|
|
|
|
class InvalidWordCount < InvalidPacket
|
|
|
|
def to_s
|
|
|
|
"The server responded with unimplemented WordCount " +
|
|
|
|
self.word_count.to_s + ' for command ' + self.command.to_s
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class InvalidCommand < InvalidPacket
|
|
|
|
def to_s
|
|
|
|
"The server responded with unimplemented command " +
|
|
|
|
self.command.to_s + ' with WordCount ' + self.word_count.to_s
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class InvalidType < InvalidPacket
|
|
|
|
def to_s
|
|
|
|
"The server responded with unexpected packet (Command=" +
|
|
|
|
self.command.to_s + ' WordCount=' + self.word_count.to_s + ")"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class ErrorCode < InvalidPacket
|
2005-09-22 09:04:54 +00:00
|
|
|
def to_s
|
2005-09-23 03:43:04 +00:00
|
|
|
"The server responded with error code " + sprintf("0x%.8x", self.error_code) +
|
|
|
|
" (Command=" + self.command.to_s +
|
|
|
|
' WordCount=' + self.word_count.to_s + ")"
|
2005-09-22 09:04:54 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class NetbiosSessionFailed < Error
|
|
|
|
def to_s
|
|
|
|
"The server refused our NetBIOS session request"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2005-09-23 09:14:03 +00:00
|
|
|
class SimpleClientError < Error
|
|
|
|
attr_accessor :source, :fatal
|
|
|
|
end
|
2005-09-23 03:43:04 +00:00
|
|
|
|
2005-09-23 09:14:03 +00:00
|
|
|
class LoginError < SimpleClientError
|
|
|
|
def to_s
|
|
|
|
"Login Failed: " + self.source
|
|
|
|
end
|
|
|
|
end
|
2005-09-23 03:43:04 +00:00
|
|
|
|
2005-09-22 09:04:54 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|