def getNotes(self): ''' Retrieve a list of the ElfNote vstructs from any sections of type SHT_NOTE. Example: for note in e.getNotes(): print('%s : %d' % (e.name, e.ntype)) ''' for sec in self.getSections(): if sec.sh_type != SHT_NOTE: continue try: notebytes = self.readAtOffset(sec.sh_offset, sec.sh_size) offset = 0 notebyteslen = len(notebytes) while offset < notebyteslen: note = vs_elf.ElfNote() if notebyteslen - offset < len(note): logger.warn( """\nNOTES section length mismatch!\n\t%s \tSection Bytes: %s\n\tStranded bytes: %s\n""", sec, repr(notebytes), repr(notebytes[offset:])) break offset = note.vsParse(notebytes, offset=offset) yield note except Exception as e: logger.warn("Elf.getNotes() Exception: %r", e)
def getNotes(self): ''' Retrieve a list of the ElfNote vstructs from any sections of type SHT_NOTE. Example: for note in e.getNotes(): print('%s : %d' % (e.name,e.ntype)) ''' for sec in self.getSections(): if sec.sh_type != SHT_NOTE: continue notebytes = self.readAtOffset(sec.sh_offset, sec.sh_size) offset = 0 while offset < len(notebytes): note = vs_elf.ElfNote() offset = note.vsParse(notebytes,offset=offset) yield note