def get_section_content()

in nightMARE/src/nightmare/utils.py [0:0]


def get_section_content(pe: lief.PE.Binary, section_name: str) -> None | bytes:
    """
    The function gets the section content from a lief._lief.PE.Binary object
    :param pe: is a lief._lief.PE.Binary
    :param section_name: is the section name
    """
    if not pe:
        return None
    for section in pe.sections:
        if section.name.lower() == section_name:
            return bytes(section.content)
    else:
        return None