]> lifelog.hopto.org Git - wb-shell-scripts.git/commitdiff
This utility is useful to obtain all programs using an certain in name 'cryptic'...
authorWill Budic <redacted>
Tue, 17 Feb 2026 21:51:18 +0000 (08:51 +1100)
committerWill Budic <redacted>
Tue, 17 Feb 2026 21:51:18 +0000 (08:51 +1100)
lib_dep_check_ldd.sh [new file with mode: 0755]

diff --git a/lib_dep_check_ldd.sh b/lib_dep_check_ldd.sh
new file mode 100755 (executable)
index 0000000..193f194
--- /dev/null
@@ -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
+
+