Пример #1
0
class Section64(IndexedHeader):
    ENDIAN = None
    FIELDS = (
        NullTerminatedStringField('sectname', '16s'),
        NullTerminatedStringField('segname', '16s'),
        HexField('addr', 'Q'),
        Field('size', 'Q'),
        Field('offset', 'I'),
        Field('align', 'I'),
        Field('reloff', 'I'),
        Field('nreloc', 'I'),
        HexField('flags', 'I'),
        Field('reserved1', 'I'),
        Field('reserved2', 'I'),
        Field('reserved3', 'I'),
    )

    NEXT_INDEX = 1

    def __init__(self, bytes_=None, **kwargs):
        self.sectname = None
        self.segname = None
        self.addr = None
        self.size = None
        self.offset = None
        self.align = None
        self.reloff = None
        self.nreloc = None
        self.flags = None
        self.reserved1 = None
        self.reserved2 = None
        super(Section64, self).__init__('section_64', bytes_, **kwargs)
Пример #2
0
class SegmentCommand(LoadCommandHeader):
    ENDIAN = None
    FIELDS = (
        MagicField('cmd', 'I', {LoadCommandCommand.COMMANDS['LC_SEGMENT']: 'LC_SEGMENT'}),
        Field('cmdsize', 'I'),
        NullTerminatedStringField('segname', '16s'),
        HexField('vmaddr', 'I'),
        Field('vmsize', 'I'),
        Field('fileoff', 'I'),
        Field('filesize', 'I'),
        Field('maxprot', 'I'),
        Field('initprot', 'I'),
        Field('nsects', 'I'),
        HexField('flags', 'I'),
    )

    def __init__(self, bytes_=None, **kwargs):
        self.segname = None
        self.vmaddr = None
        self.vmsize = None
        self.fileoff = None
        self.filesize = None
        self.maxprot = None
        self.initprot = None
        self.nsects = None
        self.flags = None
        super(SegmentCommand, self).__init__('segment_command', bytes_, **kwargs)