Class: Rex::MachParsey::FatBase::FatHeader

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) ⇒ FatHeader

Returns a new instance of FatHeader.



350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
# File 'lib/rex/machparsey/machbase.rb', line 350

def initialize(rawdata)
  fat_header = FAT_HEADER_LSB.make_struct
  if !fat_header.from_s(rawdata)
    #raise something
  end

  magic = fat_header.v['magic']
  if magic == FAT_MAGIC
    endian = ENDIAN_LSB
  elsif magic == FAT_CIGAM
    endian = ENDIAN_MSB
    fat_header = FAT_HEADER_MSB.make_struct
    if !fat_header.from_s(rawdata)
      raise FatHeaderError, "Could not parse FAT header"
    end
  else
    self.exists = 0
    return
  end

  self.nfat_arch = fat_header.v['nfat_arch']
  self.struct = fat_header
  self.endian = endian
end

Dynamic Method Handling

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

Instance Attribute Details

#endianObject

Returns the value of attribute endian.



348
349
350
# File 'lib/rex/machparsey/machbase.rb', line 348

def endian
  @endian
end

#existsObject

Returns the value of attribute exists.



348
349
350
# File 'lib/rex/machparsey/machbase.rb', line 348

def exists
  @exists
end

#nfat_archObject

Returns the value of attribute nfat_arch.



348
349
350
# File 'lib/rex/machparsey/machbase.rb', line 348

def nfat_arch
  @nfat_arch
end