# This file is part of Mach-O Loader for CLE.# Contributed December 2016 by Fraunhofer SIT (https://www.sit.fraunhofer.de/en/).fromcle.backends.regionimportSegment
[docs]classMachOSegment(Segment):""" Mach-O Segment - offset is the offset into the file the region starts - vaddr (or just addr) is the virtual address - filesize (or just size) is the size of the region in the file - memsize (or vsize) is the size of the region when loaded into memory - segname is the segment's name without padding - nsect is the number of sections contained in this segment - sections is an array of MachOSections - flags is a bit vector containing per-segment flags - initprot and maxprot are initial and maximum permissions respectively """
[docs]defget_section_by_name(self,name):""" Searches for a section by name within this segment :param name: Name of the section :return: MachOSection or None """forsecinself.sections:ifsec.sectname==name:returnsecreturnNone