Module: Rex::Proto::TFTP

Defined in:
lib/rex/proto/tftp/client.rb,
lib/rex/proto/tftp/server.rb,
lib/rex/proto/tftp/constants.rb

Defined Under Namespace

Classes: Client, Server

Constant Summary collapse

OPCODES =
%w{ Unknown RRQ WRQ DATA ACK ERROR }
OpRead =
1
OpWrite =
2
OpData =
3
OpAck =
4
OpError =
5
OpOptAck =
6
ERRCODES =
[
  "Undefined",
  "File not found",
  "Access violation",
  "Disk full or allocation exceeded",
  "Illegal TFTP operation",
  "Unknown transfer ID",
  "File already exists",
  "No such user",
  "Failed option negotiation"
]
ErrFileNotFound =
1
ErrAccessViolation =
2
ErrDiskFull =
3
ErrIllegalOperation =
4
ErrUnknownTransferId =
5
ErrFileExists =
6
ErrNoSuchUser =
7
ErrFailedOptNegotiation =
8

Class Method Summary collapse

Class Method Details

.get_string(data) ⇒ Object

Little util function


12
13
14
15
16
17
18
19
# File 'lib/rex/proto/tftp/server.rb', line 12

def self.get_string(data)
  idx = data.index("\x00")
  return nil if not idx
  ret = data.slice!(0, idx)
  # Slice off the nul byte.
  data.slice!(0,1)
  ret
end