From: Will Budic Date: Tue, 17 Feb 2026 21:51:18 +0000 (+1100) Subject: This utility is useful to obtain all programs using an certain in name 'cryptic'... X-Git-Url: https://lifelog.hopto.org/gitweb/?a=commitdiff_plain;h=9bdf77cc3ce555b1dd930566374eacd1bcdb2c1d;p=wb-shell-scripts.git This utility is useful to obtain all programs using an certain in name 'cryptic' or suspicious library. --- diff --git a/lib_dep_check_ldd.sh b/lib_dep_check_ldd.sh new file mode 100755 index 0000000..193f194 --- /dev/null +++ b/lib_dep_check_ldd.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# This utility is useful to obtain all programs using an certain in name 'cryptic' or suspicious library. +# Syntax: ./lib_dep_check_ldd.sh {lib_name} {path/to/some/bin} +# Programed by: Will Budić +# Date: 2026-02-18 + +isSearchingFor=$1 +[[ -z "$isSearchingFor" ]] && isSearchingFor="libsqlite" +echo -e "Searching for [$isSearchingFor]" +# Specify directories to check +if [ -x "$2" ]; then + directories=("$2") +else + directories=("/usr/bin" "/usr/local/bin" "/bin" "~/.local/bin") +fi +found=() +count=0 +for dir in "${directories[@]}"; do + echo -e "Examining $dir..." + for app in "$dir"/*; do + if [ -x "$app" ]; then + if ldd "$app" 2> /dev/null | grep -q "$isSearchingFor" ; then + echo -e "$app is linked to $isSearchingFor" + ((count++)) + found+=($app); + fi + fi + done +done + +for exe in "${found[@]}"; do + echo -e "Executable $exe" + ldd "$exe" | grep "$isSearchingFor" +done + +if [ "$count" == 0 ]; then + echo -e "Nothing found in executables linked to [$isSearchingFor]." +else + echo -e "Found [$isSearchingFor] linked $count times, is that scary?" +fi + +