Module: Rex::Proto::NTP::Modes

Included in:
Rex::Proto::NTP, Rex::Proto::NTP
Defined in:
lib/rex/proto/ntp/modes.rb

Defined Under Namespace

Classes: NTPControl, NTPGeneric, NTPPrivate

Instance Method Summary collapse

Instance Method Details

#describe(message) ⇒ Object

Parses the given message and provides a description about the NTP message inside



130
131
132
133
# File 'lib/rex/proto/ntp/modes.rb', line 130

def describe(message)
  ntp = NTPGeneric.new.read(message)
  "#{message.size}-byte version #{ntp.version} mode #{ntp.mode} reply"
end

#ntp_control(version, operation, payload = nil) ⇒ Object



101
102
103
104
105
106
107
108
109
110
111
# File 'lib/rex/proto/ntp/modes.rb', line 101

def ntp_control(version, operation, payload = nil)
  n = NTPControl.new
  n.version = version
  n.operation = operation
  if payload
    n.payload_offset = 0
    n.payload_size = payload.size
    n.payload = payload
  end
  n
end

#ntp_generic(version, mode) ⇒ Object



122
123
124
125
126
127
# File 'lib/rex/proto/ntp/modes.rb', line 122

def ntp_generic(version, mode)
  n = NTPGeneric.new
  n.version = version
  n.mode = mode
  n
end

#ntp_private(version, implementation, request_code, payload = nil) ⇒ Object



113
114
115
116
117
118
119
120
# File 'lib/rex/proto/ntp/modes.rb', line 113

def ntp_private(version, implementation, request_code, payload = nil)
  n = NTPPrivate.new
  n.version = version
  n.implementation = implementation
  n.request_code = request_code
  n.payload = payload if payload
  n
end