Skip to content

Instantly share code, notes, and snippets.

@yurial
Created July 9, 2015 06:17
Show Gist options
  • Save yurial/97c5acd31b7d7cb87e5b to your computer and use it in GitHub Desktop.
Save yurial/97c5acd31b7d7cb87e5b to your computer and use it in GitHub Desktop.
libfunc
#/usr/bin/env bash
$(readelf -V $1 |sed -n "/.gnu.version_r.*/,/#/p" | while read LINE; do
echo $LINE |grep -q 'File: ';
if [ $? -eq 0 ]; then
CURLIB=`echo $LINE |egrep -o "([a-zA-Z0-9\.]+?\.so(\.[a-zA-Z0-9\.]+?)?)"`;
else
echo $LINE |grep -q 'Version: ';
if [ $? -eq 0 ]; then
VER=`echo $LINE |egrep -o "Version: [0-9]+" |egrep -o "[0-9]+"`;
echo "export LIB$VER=$CURLIB";
fi;
fi;
done;)
readelf -s $1 |egrep -o "[_a-zA-Z0-9]+@[\._A-Z0-9]+ \([0-9]+\)" |awk -F"@| |[(]|[)]" '{system("printf \"%30s %-16s %s\\n\" "$1" "$2" $LIB"$4)}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment