Advertisement
Guest User

Untitled

a guest
May 24th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.05 KB | None | 0 0
  1. #define _GNU_SOURCE
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <elf.h>
  5. #include <sys/types.h>
  6. #include <search.h>
  7. #include <sys/time.h>
  8. #include "../include/libelfmaster.h"
  9.  
  10. int main(int argc, char **argv)
  11. {
  12. elfobj_t obj;
  13. elf_error_t error;
  14. elf_plt_iterator_t iter;
  15. struct elf_plt plt;
  16.  
  17. if (argc < 2) {
  18. printf("Usage: %s <binary>\n", argv[0]);
  19. exit(EXIT_SUCCESS);
  20. }
  21. if (elf_open_object(argv[1], &obj, false, &error) == false) {
  22. fprintf(stderr, "%s\n", elf_error_msg(&error));
  23. return -1;
  24. }
  25. elf_plt_iterator_init(&obj, &iter);
  26. while(elf_plt_iterator_next(&iter, &plt) == ELF_ITER_OK)
  27. printf("%#08lx: %s\n", plt.addr, plt.symname);
  28. return 0;
  29. }
  30.  
  31. -----------------------------
  32.  
  33. Output:
  34.  
  35. elfmaster@shell:~/libelfmaster/examples$ ./plt_dump /bin/ls
  36. 0x4029e0: __sprintf_chk
  37. 0x4029d0: __ctype_b_loc
  38. 0x4029c0: __ctype_tolower_loc
  39. 0x4029b0: strstr
  40. 0x4029a0: sigaddset
  41. 0x402990: iswprint
  42. 0x402980: mbsinit
  43. 0x402970: fflush_unlocked
  44. 0x402960: __fprintf_chk
  45. 0x402950: fwrite
  46. 0x402940: exit
  47. 0x402930: sigismember
  48. 0x402920: freecon
  49. 0x402910: getxattr
  50. 0x402900: wcstombs
  51. 0x4028f0: __cxa_atexit
  52. 0x4028e0: strtoul
  53. 0x4028d0: unsetenv
  54. 0x4028c0: fseeko
  55. 0x4028b0: open
  56. 0x4028a0: error
  57. 0x402890: memmove
  58. 0x402880: mempcpy
  59. 0x402870: strftime
  60. 0x402860: timegm
  61. 0x402850: __printf_chk
  62. 0x402840: setlocale
  63. 0x402830: fdopen
  64. 0x402820: stpncpy
  65. 0x402810: realloc
  66. 0x402800: fwrite_unlocked
  67. 0x4027f0: __freading
  68. 0x4027e0: strcoll
  69. 0x4027d0: __fxstat
  70. 0x4027c0: ungetc
  71. 0x4027b0: nl_langinfo
  72. 0x4027a0: fflush
  73. 0x402790: malloc
  74. 0x402780: wcwidth
  75. 0x402770: readdir
  76. 0x402760: __xstat
  77. 0x402750: tcgetpgrp
  78. 0x402740: fileno
  79. 0x402730: tzset
  80. 0x402720: getfilecon
  81. 0x402710: getgrnam
  82. 0x402700: memcpy
  83. 0x4026f0: sigemptyset
  84. 0x4026e0: __memcpy_chk
  85. 0x4026d0: getpwnam
  86. 0x4026c0: dirfd
  87. 0x4026b0: signal
  88. 0x4026a0: strcmp
  89. 0x402690: lgetfilecon
  90. 0x402680: calloc
  91. 0x402670: fputs_unlocked
  92. 0x402660: _setjmp
  93. 0x402650: memcmp
  94. 0x402640: __libc_start_main
  95. 0x402630: closedir
  96. 0x402620: close
  97. 0x402610: ioctl
  98. 0x402600: fscanf
  99. 0x4025f0: memset
  100. 0x4025e0: fnmatch
  101. 0x4025d0: __strtoul_internal
  102. 0x4025c0: __assert_fail
  103. 0x4025b0: gettimeofday
  104. 0x4025a0: lseek
  105. 0x402590: gmtime_r
  106. 0x402580: fgetfilecon
  107. 0x402570: strrchr
  108. 0x402560: __overflow
  109. 0x402550: getgrgid
  110. 0x402540: strchr
  111. 0x402530: mbrtowc
  112. 0x402520: getopt_long
  113. 0x402510: __stack_chk_fail
  114. 0x402500: __lxstat
  115. 0x4024f0: strlen
  116. 0x4024e0: __ctype_get_mb_cur_max
  117. 0x4024d0: dcgettext
  118. 0x4024c0: stpcpy
  119. 0x4024b0: bindtextdomain
  120. 0x4024a0: getpwuid
  121. 0x402490: opendir
  122. 0x402480: fclose
  123. 0x402470: textdomain
  124. 0x402460: setenv
  125. 0x402450: clock_gettime
  126. 0x402440: readlink
  127. 0x402430: mbstowcs
  128. 0x402420: localeconv
  129. 0x402410: wcswidth
  130. 0x402400: iswcntrl
  131. 0x4023f0: sigaction
  132. 0x4023e0: isatty
  133. 0x4023d0: __fpending
  134. 0x4023c0: strcpy
  135. 0x4023b0: _exit
  136. 0x4023a0: localtime_r
  137. 0x402390: strncmp
  138. 0x402380: __errno_location
  139. 0x402370: abort
  140. 0x402360: __mempcpy_chk
  141. 0x402350: localtime
  142. 0x402340: free
  143. 0x402330: raise
  144. 0x402320: sigprocmask
  145. 0x402310: getenv
  146. 0x402300: __uflow
  147. 0x4022f0: __ctype_toupper_loc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement