INNER CODE UNIT · JavaScript
phnum
hackcatml/frida-flutterproxy · script.js:458
var phnum = is32bit ? base.add(off_of_Elf32_Ehdr_phnum).readU16() : base.add(off_of_Elf64_Ehdr_phnum).readU16(); // Number of entries in program header table
// If phnum is 0, try to get it from the file
if (phnum == 0) {
if (fd != null && fd !== -1){
console.log("[!] phnum 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);
phnum = is32bit ? ehdrs_from_file.add(off_of_Elf32_Ehdr_phnum).readU16() : ehdrs_from_file.add(off_of_Elf64_Ehdr_phnum).readU16();
if (phnum == 0) {
console.log("[!] phnum is still 0. Let's assume it's 10. because we just need to find .dynamic section");
phnum = 10;
} else {
console.log(`[*] phnum from the file: ${phnum}`)
}
} else {
console.log("[!] phnum is 0. Let's assume it's 10. because we just need to find .dynamic section")
phnum = 10;