Module: Rex::Proto::DNS::Packet::Raw
- Defined in:
- lib/rex/proto/dns/packet.rb
Class Method Summary collapse
-
.from_int_be(data) ⇒ Array
Convert data from big endian unsigned int.
-
.from_int_le(data) ⇒ Array
Convert data from little endian unsigned int.
-
.from_long_be(data) ⇒ Array
Convert data from big endian unsigned long.
-
.from_long_le(data) ⇒ Array
Convert data from little endian unsigned long.
-
.from_short_be(data) ⇒ Array
Convert data from big endian unsigned short.
-
.from_short_le(data) ⇒ Array
Convert data from little endian unsigned short.
-
.request_id(data) ⇒ Fixnum
Returns request ID from raw packet skipping parsing.
-
.request_length(data) ⇒ Fixnum
Returns request length from raw packet skipping parsing.
-
.to_int_be(data) ⇒ String
Convert data to big endian unsigned int.
-
.to_int_le(data) ⇒ String
Convert data to little endian unsigned int.
-
.to_long_be(data) ⇒ String
Convert data to big endian unsigned long.
-
.to_long_le(data) ⇒ String
Convert data to little endian unsigned long.
-
.to_short_be(data) ⇒ String
Convert data to big endian unsigned short.
-
.to_short_le(data) ⇒ String
Convert data to little endian unsigned short.
Class Method Details
.from_int_be(data) ⇒ Array
Convert data from big endian unsigned int
267 268 269 |
# File 'lib/rex/proto/dns/packet.rb', line 267 def self.from_int_be(data) data.unpack('I>*') end |
.from_int_le(data) ⇒ Array
Convert data from little endian unsigned int
207 208 209 |
# File 'lib/rex/proto/dns/packet.rb', line 207 def self.from_int_le(data) data.unpack('I*') end |
.from_long_be(data) ⇒ Array
Convert data from big endian unsigned long
287 288 289 |
# File 'lib/rex/proto/dns/packet.rb', line 287 def self.from_long_be(data) data.unpack('L>*') end |
.from_long_le(data) ⇒ Array
Convert data from little endian unsigned long
227 228 229 |
# File 'lib/rex/proto/dns/packet.rb', line 227 def self.from_long_le(data) data.unpack('L*') end |
.from_short_be(data) ⇒ Array
Convert data from big endian unsigned short
247 248 249 |
# File 'lib/rex/proto/dns/packet.rb', line 247 def self.from_short_be(data) data.unpack('S>*') end |
.from_short_le(data) ⇒ Array
Convert data from little endian unsigned short
187 188 189 |
# File 'lib/rex/proto/dns/packet.rb', line 187 def self.from_short_le(data) data.unpack('S*') end |
.request_id(data) ⇒ Fixnum
Returns request ID from raw packet skipping parsing
297 298 299 |
# File 'lib/rex/proto/dns/packet.rb', line 297 def self.request_id(data) self.from_short_be(data[0..1])[0] end |
.request_length(data) ⇒ Fixnum
Returns request length from raw packet skipping parsing
307 308 309 |
# File 'lib/rex/proto/dns/packet.rb', line 307 def self.request_length(data) self.from_short_le(data[0..2])[0] end |
.to_int_be(data) ⇒ String
Convert data to big endian unsigned int
257 258 259 |
# File 'lib/rex/proto/dns/packet.rb', line 257 def self.to_int_be(data) [data].flatten.pack('I>*') end |
.to_int_le(data) ⇒ String
Convert data to little endian unsigned int
197 198 199 |
# File 'lib/rex/proto/dns/packet.rb', line 197 def self.to_int_le(data) [data].flatten.pack('I*') end |
.to_long_be(data) ⇒ String
Convert data to big endian unsigned long
277 278 279 |
# File 'lib/rex/proto/dns/packet.rb', line 277 def self.to_long_be(data) [data].flatten.pack('L>*') end |
.to_long_le(data) ⇒ String
Convert data to little endian unsigned long
217 218 219 |
# File 'lib/rex/proto/dns/packet.rb', line 217 def self.to_long_le(data) [data].flatten.pack('L*') end |
.to_short_be(data) ⇒ String
Convert data to big endian unsigned short
237 238 239 |
# File 'lib/rex/proto/dns/packet.rb', line 237 def self.to_short_be(data) [data].flatten.pack('S>*') end |
.to_short_le(data) ⇒ String
Convert data to little endian unsigned short
177 178 179 |
# File 'lib/rex/proto/dns/packet.rb', line 177 def self.to_short_le(data) [data].flatten.pack('S*') end |