Skip to content

Instantly share code, notes, and snippets.

@AlexRogalskiy
Created February 27, 2022 22:23
Show Gist options
  • Save AlexRogalskiy/010f0780e59c61a328cc06fb8149f88a to your computer and use it in GitHub Desktop.
Save AlexRogalskiy/010f0780e59c61a328cc06fb8149f88a to your computer and use it in GitHub Desktop.
Linux: find all library packages required by all binaries in the current subtree (can take 5-10 minutes)
find -type f -exec file {} \; \
| awk -F: '/ELF/{print$1}' \
| xargs -I% readelf -d % \
| awk '/Shared/{gsub("\\[","",$5);gsub("\\]","",$5);if(length($5)>1){x[$5]++}} END{for(i in x){print i}}' \
| xargs -L1 apt-file find \
| awk -F: '{x[$1]++} END{for(i in x){print i}}' \
| awk '!/32|-dbg$|-i386$/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment