Class: Rex::MachParsey::FatBase::FatArch

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, endian) ⇒ FatArch

Returns a new instance of FatArch.



380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
# File 'lib/rex/machparsey/machbase.rb', line 380

def initialize(rawdata, endian)
	if endian == ENDIAN_LSB
		fat_arch = FAT_ARCH_LSB.make_struct
	else
		fat_arch = FAT_ARCH_MSB.make_struct
	end

	if !fat_arch.from_s(rawdata)
		raise FatHeaderError, "Could not parse arch from FAT header"
	end

	self.cpu_type = fat_arch.v['cpu_type']
	self.cpu_subtype = fat_arch.v['cpu_subtype']
	self.offset = fat_arch.v['offset']
	self.size = fat_arch.v['size']
	self.struct = fat_arch
end

Dynamic Method Handling

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

Instance Attribute Details

#cpu_subtypeObject

Returns the value of attribute cpu_subtype.



378
379
380
# File 'lib/rex/machparsey/machbase.rb', line 378

def cpu_subtype
  @cpu_subtype
end

#cpu_typeObject

Returns the value of attribute cpu_type.



378
379
380
# File 'lib/rex/machparsey/machbase.rb', line 378

def cpu_type
  @cpu_type
end

#offsetObject

Returns the value of attribute offset.



378
379
380
# File 'lib/rex/machparsey/machbase.rb', line 378

def offset
  @offset
end

#sizeObject

Returns the value of attribute size.



378
379
380
# File 'lib/rex/machparsey/machbase.rb', line 378

def size
  @size
end