Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _GNU_SOURCE
- #include <stdio.h>
- #include <stdlib.h>
- #include <elf.h>
- #include <sys/types.h>
- #include <search.h>
- #include <sys/time.h>
- #include "../include/libelfmaster.h"
- int main(int argc, char **argv)
- {
- elfobj_t obj;
- elf_error_t error;
- elf_plt_iterator_t iter;
- struct elf_plt plt;
- if (argc < 2) {
- printf("Usage: %s <binary>\n", argv[0]);
- exit(EXIT_SUCCESS);
- }
- if (elf_open_object(argv[1], &obj, false, &error) == false) {
- fprintf(stderr, "%s\n", elf_error_msg(&error));
- return -1;
- }
- elf_plt_iterator_init(&obj, &iter);
- while(elf_plt_iterator_next(&iter, &plt) == ELF_ITER_OK)
- printf("%#08lx: %s\n", plt.addr, plt.symname);
- return 0;
- }
- -----------------------------
- Output:
- elfmaster@shell:~/libelfmaster/examples$ ./plt_dump /bin/ls
- 0x4029e0: __sprintf_chk
- 0x4029d0: __ctype_b_loc
- 0x4029c0: __ctype_tolower_loc
- 0x4029b0: strstr
- 0x4029a0: sigaddset
- 0x402990: iswprint
- 0x402980: mbsinit
- 0x402970: fflush_unlocked
- 0x402960: __fprintf_chk
- 0x402950: fwrite
- 0x402940: exit
- 0x402930: sigismember
- 0x402920: freecon
- 0x402910: getxattr
- 0x402900: wcstombs
- 0x4028f0: __cxa_atexit
- 0x4028e0: strtoul
- 0x4028d0: unsetenv
- 0x4028c0: fseeko
- 0x4028b0: open
- 0x4028a0: error
- 0x402890: memmove
- 0x402880: mempcpy
- 0x402870: strftime
- 0x402860: timegm
- 0x402850: __printf_chk
- 0x402840: setlocale
- 0x402830: fdopen
- 0x402820: stpncpy
- 0x402810: realloc
- 0x402800: fwrite_unlocked
- 0x4027f0: __freading
- 0x4027e0: strcoll
- 0x4027d0: __fxstat
- 0x4027c0: ungetc
- 0x4027b0: nl_langinfo
- 0x4027a0: fflush
- 0x402790: malloc
- 0x402780: wcwidth
- 0x402770: readdir
- 0x402760: __xstat
- 0x402750: tcgetpgrp
- 0x402740: fileno
- 0x402730: tzset
- 0x402720: getfilecon
- 0x402710: getgrnam
- 0x402700: memcpy
- 0x4026f0: sigemptyset
- 0x4026e0: __memcpy_chk
- 0x4026d0: getpwnam
- 0x4026c0: dirfd
- 0x4026b0: signal
- 0x4026a0: strcmp
- 0x402690: lgetfilecon
- 0x402680: calloc
- 0x402670: fputs_unlocked
- 0x402660: _setjmp
- 0x402650: memcmp
- 0x402640: __libc_start_main
- 0x402630: closedir
- 0x402620: close
- 0x402610: ioctl
- 0x402600: fscanf
- 0x4025f0: memset
- 0x4025e0: fnmatch
- 0x4025d0: __strtoul_internal
- 0x4025c0: __assert_fail
- 0x4025b0: gettimeofday
- 0x4025a0: lseek
- 0x402590: gmtime_r
- 0x402580: fgetfilecon
- 0x402570: strrchr
- 0x402560: __overflow
- 0x402550: getgrgid
- 0x402540: strchr
- 0x402530: mbrtowc
- 0x402520: getopt_long
- 0x402510: __stack_chk_fail
- 0x402500: __lxstat
- 0x4024f0: strlen
- 0x4024e0: __ctype_get_mb_cur_max
- 0x4024d0: dcgettext
- 0x4024c0: stpcpy
- 0x4024b0: bindtextdomain
- 0x4024a0: getpwuid
- 0x402490: opendir
- 0x402480: fclose
- 0x402470: textdomain
- 0x402460: setenv
- 0x402450: clock_gettime
- 0x402440: readlink
- 0x402430: mbstowcs
- 0x402420: localeconv
- 0x402410: wcswidth
- 0x402400: iswcntrl
- 0x4023f0: sigaction
- 0x4023e0: isatty
- 0x4023d0: __fpending
- 0x4023c0: strcpy
- 0x4023b0: _exit
- 0x4023a0: localtime_r
- 0x402390: strncmp
- 0x402380: __errno_location
- 0x402370: abort
- 0x402360: __mempcpy_chk
- 0x402350: localtime
- 0x402340: free
- 0x402330: raise
- 0x402320: sigprocmask
- 0x402310: getenv
- 0x402300: __uflow
- 0x4022f0: __ctype_toupper_loc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement