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, NTPSymmetric

Instance Method Summary collapse

Instance Method Details

#describe(message) ⇒ Object

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



149
150
151
152
# File 'lib/rex/proto/ntp/modes.rb', line 149

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



120
121
122
123
124
125
126
127
128
129
130
# File 'lib/rex/proto/ntp/modes.rb', line 120

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



141
142
143
144
145
146
# File 'lib/rex/proto/ntp/modes.rb', line 141

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



132
133
134
135
136
137
138
139
# File 'lib/rex/proto/ntp/modes.rb', line 132

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