class Metasm::UniversalBinary

Constants

MAGIC

Attributes

archive[RW]
encoded[RW]
endianness[RW]
header[RW]

Public Class Methods

autoexe_load(*a) click to toggle source
Calls superclass method Metasm::ExeFormat::autoexe_load
# File metasm/exe_format/macho.rb, line 1019
def self.autoexe_load(*a)
        ub = super(*a)
        ub.decode
        # TODO have a global callback or whatever to prompt the user
        # which file he wants to load in the dasm
        puts "UniversalBinary: using 1st archive member" if $VERBOSE
        AutoExe.load(ub.archive[0].encoded)
end
new() click to toggle source
Calls superclass method Metasm::ExeFormat::new
# File metasm/exe_format/macho.rb, line 1002
def initialize
        @endianness = :big
        super()
end

Public Instance Methods

<<(exe) click to toggle source
# File metasm/exe_format/macho.rb, line 1017
def <<(exe) @archive << exe end
[](i) click to toggle source
# File metasm/exe_format/macho.rb, line 1016
def [](i) AutoExe.decode(@archive[i].encoded) if @archive[i] end
decode() click to toggle source
# File metasm/exe_format/macho.rb, line 1007
def decode
        @header = Header.decode(self)
        @archive = []
        @header.nfat_arch.times { @archive << FatArch.decode(self) }
        @archive.each { |a|
                a.encoded = @encoded[a.offset, a.size] || EncodedData.new
        }
end
decode_word(edata = @encoded) click to toggle source
# File metasm/exe_format/macho.rb, line 998
def decode_word(edata = @encoded) edata.decode_imm(:u32, @endianness) end
encode_word(val) click to toggle source
# File metasm/exe_format/macho.rb, line 997
def encode_word(val)        Expression[val].encode(:u32, @endianness) end
sizeof_word() click to toggle source
# File metasm/exe_format/macho.rb, line 999
def sizeof_word ; 4 ; end