Class: Rex::MachParsey::MachBase::Segment

Inherits:
GenericHeader show all
Defined in:
lib/rex/machparsey/machbase.rb

Instance Attribute Summary collapse

Attributes inherited from GenericStruct

#struct

Instance Method Summary collapse

Methods inherited from GenericStruct

#[], #keys, #method_missing, #v

Constructor Details

#initialize(rawdata, bits, endian) ⇒ Segment

Returns a new instance of Segment.



261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# File 'lib/rex/machparsey/machbase.rb', line 261

def initialize(rawdata, bits, endian)
  self._bits = bits

  if bits == BITS_64
    if endian == ENDIAN_MSB
      segment_command = SEGMENT_COMMAND_64_MSB.make_struct
    else
      segment_command = SEGMENT_COMMAND_64_LSB.make_struct
    end
  else
    if endian == ENDIAN_MSB
      segment_command = SEGMENT_COMMAND_MSB.make_struct
    else
      segment_command = SEGMENT_COMMAND_LSB.make_struct
    end
  end
  if !segment_command.from_s(rawdata)
    raise MachParseError, "Couldn't parse segment command"
  end

  self.struct = segment_command
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Rex::MachParsey::GenericStruct

Instance Attribute Details

#_bitsObject

Returns the value of attribute _bits.



259
260
261
# File 'lib/rex/machparsey/machbase.rb', line 259

def _bits
  @_bits
end

#_endianObject

Returns the value of attribute _endian.



259
260
261
# File 'lib/rex/machparsey/machbase.rb', line 259

def _endian
  @_endian
end

Instance Method Details

#FileOffObject



296
297
298
# File 'lib/rex/machparsey/machbase.rb', line 296

def FileOff
  v['fileoff']
end

#FileSizeObject



300
301
302
# File 'lib/rex/machparsey/machbase.rb', line 300

def FileSize
  v['filesize']
end

#SegnameObject



284
285
286
# File 'lib/rex/machparsey/machbase.rb', line 284

def Segname
  v['segname']
end

#VmaddrObject



288
289
290
# File 'lib/rex/machparsey/machbase.rb', line 288

def Vmaddr
  v['vmaddr']
end

#VmsizeObject



292
293
294
# File 'lib/rex/machparsey/machbase.rb', line 292

def Vmsize
  v['vmsize']
end