Class: MachO::Headers::PrelinkedKernelHeader

Inherits:
MachOStructure show all
Defined in:
lib/macho/headers.rb

Overview

Prelinked kernel/"kernelcache" header structure

Instance Method Summary collapse

Methods inherited from MachOStructure

bytesize, format, #initialize, new_from_bin

Constructor Details

This class inherits a constructor from MachO::MachOStructure

Instance Method Details

#adler32Integer

Returns a checksum for the uncompressed data.

Returns:

  • (Integer)

    a checksum for the uncompressed data



742
# File 'lib/macho/headers.rb', line 742

field :adler32, :uint32, :endian => :big

#compress_typeInteger

Returns the type of compression used.

Returns:

  • (Integer)

    the type of compression used



739
# File 'lib/macho/headers.rb', line 739

field :compress_type, :uint32, :endian => :big

#compressed_sizeInteger

Returns the size of the compressed data, in bytes.

Returns:

  • (Integer)

    the size of the compressed data, in bytes



748
# File 'lib/macho/headers.rb', line 748

field :compressed_size, :uint32, :endian => :big

#kaslr?Boolean

Returns whether this prelinked kernel supports KASLR.

Returns:

  • (Boolean)

    whether this prelinked kernel supports KASLR



763
764
765
# File 'lib/macho/headers.rb', line 763

def kaslr?
  prelink_version >= 1
end

#lzss?Boolean

Returns whether this prelinked kernel is compressed with LZSS.

Returns:

  • (Boolean)

    whether this prelinked kernel is compressed with LZSS



768
769
770
# File 'lib/macho/headers.rb', line 768

def lzss?
  compress_type == COMP_TYPE_LZSS
end

#lzvn?Boolean

Returns whether this prelinked kernel is compressed with LZVN.

Returns:

  • (Boolean)

    whether this prelinked kernel is compressed with LZVN



773
774
775
# File 'lib/macho/headers.rb', line 773

def lzvn?
  compress_type == COMP_TYPE_FASTLIB
end

#platform_namevoid

This method returns an undefined value.



757
# File 'lib/macho/headers.rb', line 757

field :platform_name, :string, :size => 64

Returns the version of the prelink format.

Returns:

  • (Integer)

    the version of the prelink format



751
# File 'lib/macho/headers.rb', line 751

field :prelink_version, :uint32, :endian => :big

#reservedvoid

This method returns an undefined value.



754
# File 'lib/macho/headers.rb', line 754

field :reserved, :string, :size => 40, :unpack => "L>10"

#root_pathvoid

This method returns an undefined value.



760
# File 'lib/macho/headers.rb', line 760

field :root_path, :string, :size => 256

#signatureInteger

Returns the magic number for a compressed header (COMPRESSED_MAGIC).

Returns:



736
# File 'lib/macho/headers.rb', line 736

field :signature, :uint32, :endian => :big

#to_hHash

Returns a hash representation of this MachO::Headers::PrelinkedKernelHeader.

Returns:



778
779
780
781
782
783
784
785
786
787
788
789
790
# File 'lib/macho/headers.rb', line 778

def to_h
  {
    "signature" => signature,
    "compress_type" => compress_type,
    "adler32" => adler32,
    "uncompressed_size" => uncompressed_size,
    "compressed_size" => compressed_size,
    "prelink_version" => prelink_version,
    "reserved" => reserved,
    "platform_name" => platform_name,
    "root_path" => root_path,
  }.merge super
end

#uncompressed_sizeInteger

Returns the size of the uncompressed data, in bytes.

Returns:

  • (Integer)

    the size of the uncompressed data, in bytes



745
# File 'lib/macho/headers.rb', line 745

field :uncompressed_size, :uint32, :endian => :big