From 01d469e182d530649a0c182e113f34334efcffed Mon Sep 17 00:00:00 2001 From: Karmaz95 Date: Tue, 29 Oct 2024 19:28:05 +0100 Subject: [PATCH] Uploading script that checks if a given UUID is present in a list of files --- IX. TCC/custom/uuid_checker.sh | 37 ++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 IX. TCC/custom/uuid_checker.sh diff --git a/IX. TCC/custom/uuid_checker.sh b/IX. TCC/custom/uuid_checker.sh new file mode 100644 index 0000000..6570b14 --- /dev/null +++ b/IX. TCC/custom/uuid_checker.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# This script checks if a given UUID is present in a list of files using dwarfdump. +# Usage: ./uuid_checker.sh + +# Check if exactly two arguments are provided +if [ "$#" -ne 2 ]; then + echo "Usage: ./uuid_checker.sh " + exit 1 +fi + +# UUID to search for (first argument) +search_uuid="$1" + +# File list (second argument) +file_list="$2" + +# Check if the file list exists +if [ ! -f "$file_list" ]; then + echo "File list not found: $file_list" + exit 1 +fi + +# Read each file path from the file list +while IFS= read -r file_path; do + # Skip empty lines + if [ -z "$file_path" ]; then + continue + fi + + # Use dwarfdump to get UUIDs for all architectures in the file + uuids=$(dwarfdump --uuid "$file_path" 2>/dev/null) + + # Check if the search UUID is in the output + if echo "$uuids" | grep -qi "$search_uuid"; then + echo "Match found in: $file_path" + fi +done < "$file_list" \ No newline at end of file