Example #1
0
        private ELFFileTable ReadFileTable()
        {
            foreach (ELFSegment seg in _elf.Segments)
            {
                if (seg.Header.Type == ELFProgramHeaderType.Note)
                {
                    ELFNoteList noteList = new ELFNoteList(seg.Contents);
                    foreach (ELFNote note in noteList.Notes)
                    {
                        if (note.Header.Type == ELFNoteType.File)
                        {
                            return(new ELFFileTable(note.Contents));
                        }
                    }
                }
            }

            throw new BadInputFormatException("No ELF file table found");
        }
Example #2
0
        private byte[] ReadBuildID()
        {
            foreach (ELFSegment segment in Segments)
            {
                if (segment.Header.Type == ELFProgramHeaderType.Note)
                {
                    ELFNoteList noteList = new ELFNoteList(segment.Contents);
                    foreach (ELFNote note in noteList.Notes)
                    {
                        ELFNoteType type = note.Header.Type;
                        if (type == ELFNoteType.PrpsInfo && note.Name.Equals("GNU"))
                        {
                            return(note.Contents.Read(0, (uint)note.Contents.Length));
                        }
                    }
                }
            }

            return(null);
        }