INNER CODE UNIT · JavaScript
shstrndx
hackcatml/frida-flutterproxy · script.js:488
var shstrndx = is32bit ? base.add(off_of_Elf32_Ehdr_shstrndx).readU16() : base.add(off_of_Elf64_Ehdr_shstrndx).readU16(); // Section header table index of the entry associated with the section name string table
if (shnum == 0 && fd != null && fd !== -1) {
console.log("[!] shnum is 0. Try to get it from the file");
ehdrs_from_file = Memory.alloc(64);
lseek(fd, 0, SEEK_SET);
read(fd, ehdrs_from_file, 64);
shnum = is32bit ? ehdrs_from_file.add(off_of_Elf32_Ehdr_shnum).readU16() : ehdrs_from_file.add(off_of_Elf64_Ehdr_shnum).readU16();
shstrndx = is32bit ? ehdrs_from_file.add(off_of_Elf32_Ehdr_shstrndx).readU16() : ehdrs_from_file.add(off_of_Elf64_Ehdr_shstrndx).readU16();
console.log(`[*] shnum from the file: ${shnum}, shstrndx from the file: ${shstrndx}`)
}
// console.log(`phoff: ${phoff}, shoff: ${shoff}, phentsize: ${phentsize}, phnum: ${phnum}, shentsize: ${shentsize}, shnum: ${shnum}, shstrndx: ${shstrndx}`)
// Parse Phdr(Program header)
var phdrs = base.add(phoff)
for (var i = 0; i < phnum; i++) {
var phdr = phdrs.add(i * phentsize);
var p_type = phdr.readU32();