Skip to content

Instantly share code, notes, and snippets.

@Kethen
Created July 5, 2022 20:25
Show Gist options
  • Save Kethen/752338ce6b260d00a673cac97095bc70 to your computer and use it in GitHub Desktop.
Save Kethen/752338ce6b260d00a673cac97095bc70 to your computer and use it in GitHub Desktop.
symbol prober
# probes for suitable libraries for certain symbols in an elf
# for inspecting android propietary elf blobs
target=$1
library_path=$2
readelf -W -s "$target" | grep 0000000000000000 | awk '{print $8}' | while read -r LINE
do
if [ -n "$LINE" ]
then
echo "===${LINE}==="
for lib in "$library_path"/*.so
do
res=$(readelf -s $lib | grep -E " ${LINE}\$" | grep -v 0000000000000000)
if [ -n "$res" ]
then
echo $lib
echo $res
fi
done
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment