class Rex::ElfParsey::ElfBase::ProgramHeader

Public Class Methods

new(rawdata, ei_data) click to toggle source
# File lib/rex/elfparsey/elfbase.rb, line 243
def initialize(rawdata, ei_data)
  # Identify the data encoding and parse Program Header
  if ei_data == ELFDATA2LSB
    program_header = ELF32_PHDR_LSB.make_struct
  elsif ei_data == ELFDATA2MSB
    program_header = ELF32_PHDR_MSB.make_struct
  else
    raise ElfHeaderError, "Invalid data encoding", caller
  end

  if !program_header.from_s(rawdata)
    raise ProgramHeaderError, "Couldn't parse Program Header", caller
  end

  self.struct = program_header
end