public Elf64(Stream stream, float version, long maxMetadataUsages) : base(stream, version, maxMetadataUsages) { elf_header = new Elf64_Ehdr(); elf_header.ei_mag = ReadUInt32(); elf_header.ei_class = ReadByte(); elf_header.ei_data = ReadByte(); elf_header.ei_version = ReadByte(); elf_header.ei_osabi = ReadByte(); elf_header.ei_abiversion = ReadByte(); elf_header.ei_pad = ReadBytes(7); elf_header.e_type = ReadUInt16(); elf_header.e_machine = ReadUInt16(); elf_header.e_version = ReadUInt32(); elf_header.e_entry = ReadUInt64(); elf_header.e_phoff = ReadUInt64(); elf_header.e_shoff = ReadUInt64(); elf_header.e_flags = ReadUInt32(); elf_header.e_ehsize = ReadUInt16(); elf_header.e_phentsize = ReadUInt16(); elf_header.e_phnum = ReadUInt16(); elf_header.e_shentsize = ReadUInt16(); elf_header.e_shnum = ReadUInt16(); elf_header.e_shtrndx = ReadUInt16(); program_table = ReadClassArray <Elf64_Phdr>(elf_header.e_phoff, elf_header.e_phnum); GetSectionWithName(); var pt_dynamic = program_table.First(x => x.p_type == 2u); dynamic_table = ReadClassArray <Elf64_Dyn>(pt_dynamic.p_offset, (long)pt_dynamic.p_filesz / 16L); RelocationProcessing(); }
public Elf64(Stream stream, float version, long maxMetadataUsages) : base(stream, version, maxMetadataUsages) { elfHeader = ReadClass <Elf64_Ehdr>(); programSegment = ReadClassArray <Elf64_Phdr>(elfHeader.e_phoff, elfHeader.e_phnum); try { sectionTable = ReadClassArray <Elf64_Shdr>(elfHeader.e_shoff, elfHeader.e_shnum); } catch { Console.WriteLine("Detected this may be a dump file. If not, it must be protected."); isDumped = true; Console.WriteLine("Input dump address:"); dumpAddr = Convert.ToUInt64(Console.ReadLine(), 16); foreach (var phdr in programSegment) { phdr.p_offset = phdr.p_vaddr; phdr.p_filesz = phdr.p_memsz; phdr.p_vaddr += dumpAddr; } } var pt_dynamic = programSegment.First(x => x.p_type == PT_DYNAMIC); dynamicSection = ReadClassArray <Elf64_Dyn>(pt_dynamic.p_offset, (long)pt_dynamic.p_filesz / 16L); ReadSymbol(); if (!isDumped) { RelocationProcessing(); if (CheckProtection()) { Console.WriteLine("ERROR: This file may be protected."); } } }
public Elf64(Stream stream, float version, long maxMetadataUsages) : base(stream, version, maxMetadataUsages) { elf_header = new Elf64_Ehdr(); elf_header.ei_mag = ReadUInt32(); elf_header.ei_class = ReadByte(); elf_header.ei_data = ReadByte(); elf_header.ei_version = ReadByte(); elf_header.ei_osabi = ReadByte(); elf_header.ei_abiversion = ReadByte(); elf_header.ei_pad = ReadBytes(7); elf_header.e_type = ReadUInt16(); elf_header.e_machine = ReadUInt16(); elf_header.e_version = ReadUInt32(); elf_header.e_entry = ReadUInt64(); elf_header.e_phoff = ReadUInt64(); elf_header.e_shoff = ReadUInt64(); elf_header.e_flags = ReadUInt32(); elf_header.e_ehsize = ReadUInt16(); elf_header.e_phentsize = ReadUInt16(); elf_header.e_phnum = ReadUInt16(); elf_header.e_shentsize = ReadUInt16(); elf_header.e_shnum = ReadUInt16(); elf_header.e_shtrndx = ReadUInt16(); program_table_element = ReadClassArray <Elf64_Phdr>(elf_header.e_phoff, elf_header.e_phnum); GetSectionWithName(); RelocationProcessing(); }
public Elf64(Stream stream) : base(stream) { elfHeader = ReadClass <Elf64_Ehdr>(); programSegment = ReadClassArray <Elf64_Phdr>(elfHeader.e_phoff, elfHeader.e_phnum); if (!CheckSection()) { Console.WriteLine("Detected this may be a dump file."); Console.WriteLine("Input dump address or input 0 to force continue:"); dumpAddr = Convert.ToUInt64(Console.ReadLine(), 16); if (dumpAddr != 0) { isDumped = true; } } if (isDumped) { FixedProgramSegment(); } pt_dynamic = programSegment.First(x => x.p_type == PT_DYNAMIC); dynamicSection = ReadClassArray <Elf64_Dyn>(pt_dynamic.p_offset, (long)pt_dynamic.p_filesz / 16L); if (isDumped) { FixedDynamicSection(); } ReadSymbol(); if (!isDumped) { RelocationProcessing(); if (CheckProtection()) { Console.WriteLine("ERROR: This file may be protected."); } } }
public Elf64(Stream stream) : base(stream) { elfHeader = ReadClass <Elf64_Ehdr>(); programSegment = ReadClassArray <Elf64_Phdr>(elfHeader.e_phoff, elfHeader.e_phnum); if (!CheckSection()) { GetDumpAddress(); } if (IsDumped) { FixedProgramSegment(); } pt_dynamic = programSegment.First(x => x.p_type == PT_DYNAMIC); dynamicSection = ReadClassArray <Elf64_Dyn>(pt_dynamic.p_offset, (long)pt_dynamic.p_filesz / 16L); if (IsDumped) { FixedDynamicSection(); } ReadSymbol(); if (!IsDumped) { RelocationProcessing(); if (CheckProtection()) { FormGUI.Log("ERROR: This file may be protected."); } } }
public Elf64(Stream stream, float version, long maxMetadataUsages) : base(stream, version, maxMetadataUsages) { elf_header = new Elf64_Ehdr(); elf_header.ei_mag = ReadUInt32(); elf_header.ei_class = ReadByte(); elf_header.ei_data = ReadByte(); elf_header.ei_version = ReadByte(); elf_header.ei_osabi = ReadByte(); elf_header.ei_abiversion = ReadByte(); elf_header.ei_pad = ReadBytes(7); elf_header.e_type = ReadUInt16(); elf_header.e_machine = ReadUInt16(); elf_header.e_version = ReadUInt32(); elf_header.e_entry = ReadUInt64(); elf_header.e_phoff = ReadUInt64(); elf_header.e_shoff = ReadUInt64(); elf_header.e_flags = ReadUInt32(); elf_header.e_ehsize = ReadUInt16(); elf_header.e_phentsize = ReadUInt16(); elf_header.e_phnum = ReadUInt16(); elf_header.e_shentsize = ReadUInt16(); elf_header.e_shnum = ReadUInt16(); elf_header.e_shtrndx = ReadUInt16(); program_table = ReadClassArray <Elf64_Phdr>(elf_header.e_phoff, elf_header.e_phnum); if (!GetSectionWithName()) { Console.WriteLine("Detected this may be a dump file. If not, it must be protected."); isDumped = true; Console.WriteLine("Input dump address:"); dumpAddr = Convert.ToUInt64(Console.ReadLine(), 16); foreach (var phdr in program_table) { phdr.p_offset = phdr.p_vaddr; phdr.p_filesz = phdr.p_memsz; phdr.p_vaddr += dumpAddr; } } var pt_dynamic = program_table.First(x => x.p_type == 2u); dynamic_table = ReadClassArray <Elf64_Dyn>(pt_dynamic.p_offset, (long)pt_dynamic.p_filesz / 16L); if (!isDumped) { RelocationProcessing(); if (CheckProtection()) { Console.WriteLine("ERROR: This file is protected."); } } }
public Elf64(Stream stream) : base(stream) { elfHeader = ReadClass <Elf64_Ehdr>(); programSegment = ReadClassArray <Elf64_Phdr>(elfHeader.e_phoff, elfHeader.e_phnum); if (!CheckSection()) { FormGUI.WriteLine("Detected this may be a dump file."); FormDump form = new FormDump(); form.Message = 0; if (form.ShowDialog() == DialogResult.OK) { dumpAddr = Convert.ToUInt32(form.ReturnedText, 16); FormGUI.WriteLine("Inputted address: " + dumpAddr.ToString("X")); } if (dumpAddr != 0) { isDumped = true; } } if (isDumped) { FixedProgramSegment(); } pt_dynamic = programSegment.First(x => x.p_type == PT_DYNAMIC); dynamicSection = ReadClassArray <Elf64_Dyn>(pt_dynamic.p_offset, (long)pt_dynamic.p_filesz / 16L); if (isDumped) { FixedDynamicSection(); } ReadSymbol(); if (!isDumped) { RelocationProcessing(); if (CheckProtection()) { FormGUI.WriteLine("ERROR: This file may be protected."); } } }
protected override void Load() { elfHeader = ReadClass <Elf64_Ehdr>(0); programSegment = ReadClassArray <Elf64_Phdr>(elfHeader.e_phoff, elfHeader.e_phnum); if (IsDumped) { FixedProgramSegment(); } pt_dynamic = programSegment.First(x => x.p_type == PT_DYNAMIC); dynamicSection = ReadClassArray <Elf64_Dyn>(pt_dynamic.p_offset, (long)pt_dynamic.p_filesz / 16L); if (IsDumped) { FixedDynamicSection(); } ReadSymbol(); if (!IsDumped) { RelocationProcessing(); if (CheckProtection()) { Console.WriteLine("ERROR: This file may be protected."); } } }