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.



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

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.



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

def _bits
  @_bits
end

#_endianObject

Returns the value of attribute _endian.



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

def _endian
  @_endian
end

Instance Method Details

#FileOffObject



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

def FileOff
	v['fileoff']
end

#FileSizeObject



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

def FileSize
	v['filesize']
end

#SegnameObject



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

def Segname
	v['segname']
end

#VmaddrObject



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

def Vmaddr
	v['vmaddr']
end

#VmsizeObject



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

def Vmsize
	v['vmsize']
end