// first, Patch the DT_NEEDED, and, DT_SONAME entries // and save the DT_INIT entry long dt_strtab = GetDtStrTab (dyn, base_address); long dt_init = 0; ElfW (Dyn) * cur = dyn; printf("0 \n"); while (cur->d_tag != DT_NULL) { printf("00\n"); if (cur->d_tag == DT_NEEDED) { printf("x1\n"); printf("%x, %x, %x\n", map, dt_strtab, cur); printf("%x\n", cur->d_un); printf("%x\n", cur->d_un.d_val); char *needed = (char *)(map + dt_strtab + cur->d_un.d_val); printf("################## %x ###########, \n", needed); printf("################## %s ###########, %d \n", needed, strlen(needed)); if (std::string (needed) != "ld-linux-x86-64.so.2" && std::string (needed) != "ld-linux.so.2") { printf("1 \n"); uint32_t id = GetDepId (needed); printf("2 \n"); fileInfo.deps.push_back (id); printf("3 \n"); WriteString (needed, id); printf("4 \n"); } } else if (cur->d_tag == DT_SONAME) { printf("5 \n"); char *soname = (char *)(map + dt_strtab + cur->d_un.d_val); WriteString (soname, selfId); printf("6 \n"); } else if (cur->d_tag == DT_INIT) { printf("7 \n"); dt_init = cur->d_un.d_val; printf("8 \n"); } printf("x2\n"); cur++; } printf("x3\n"); Result: root@dowon-LinuxPC:/home/dowon/dce/dce# dce-emu-ping |
DCE Ping Emulation Example Create Node Create Device Add Internet Stack Create IPv4 Interface Run Emulation. |
0 00 5 6 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 x3 x4 0 00 x1 47cd000, d90, 4810df8 1 1 ################## 47cdd91 ###########, ################## libc.so.6 ###########, 9 1 2 3 4 x2 00 5 6 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 x3 x4 0 00 x1 47ce000, 490, 4810df8 1 1 ################## 47ce491 ###########, ################## libc.so.6 ###########, 9 1 2 3 4 x2 00 5 6 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 00 x2 x3 x4 0 00 x1 4959000, 400870, 4960e50 10 10 ################## 4d59880 ###########, 세그멘테이션 오류 (core dumped) |