diff options
| author | srdusr <trevorgray@srdusr.com> | 2025-09-24 05:25:39 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2025-09-24 05:25:39 +0200 |
| commit | a1627ac743289e768b138f1a60753a62e0869cc4 (patch) | |
| tree | 92ab373442943f621bb26b3b284bb1da90e2923a /unix/virt/checksum.sh | |
| parent | fdb0eb921205c34fb6ff5728727a097767ffae5a (diff) | |
| download | dotfiles-a1627ac743289e768b138f1a60753a62e0869cc4.tar.gz dotfiles-a1627ac743289e768b138f1a60753a62e0869cc4.zip | |
Update/Overhaul
Diffstat (limited to 'unix/virt/checksum.sh')
| -rwxr-xr-x | unix/virt/checksum.sh | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/unix/virt/checksum.sh b/unix/virt/checksum.sh deleted file mode 100755 index adb6a24..0000000 --- a/unix/virt/checksum.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -# Check if the correct number of arguments are provided -if [[ $# -ne 2 ]]; then - echo "Usage: checksum <file> <website>" - exit 1 -fi - -FILE=$1 -CHECKSUM_PAGE=$2 - -# Fetch the HTML content of the page -HTML_CONTENT=$(curl -s "$CHECKSUM_PAGE") - -# Try searching for checksums with a more targeted approach, like matching a checksum pattern or look for files with checksum labels -CHECKSUM=$(echo "$HTML_CONTENT" | grep -oP '([a-f0-9]{64})' | head -n 1) # Try specifically looking for SHA256 checksum patterns - -# Check if any checksum was found -if [[ -z "$CHECKSUM" ]]; then - echo "Checksum not found on the page." - exit 1 -fi - -# Calculate the checksum of the file locally -LOCAL_CHECKSUM=$(sha256sum "$FILE" | awk '{print $1}') - -echo "Local checksum: $LOCAL_CHECKSUM" -echo "Remote checksum: $CHECKSUM" - -# Compare the local checksum with the one from the website -if [[ "$LOCAL_CHECKSUM" == "$CHECKSUM" ]]; then - echo "The checksums match! The file is verified." - -else - echo "The checksums do not match. The file may be corrupted or tampered with." -fi |
