Improved test script.
This commit is contained in:
parent
393120ac58
commit
b00f31bd72
@ -1,31 +1,28 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
|
|
||||||
|
if [ "$(find . -maxdepth 1 -type f -perm /111 -name 'slunkcrypt*' | sed -e 's/^[[:blank:]]*//;s/[[:blank:]]*$//' -e '/^$/d' | wc -l)" -lt 1 ]; then
|
||||||
|
echo "No Slunkcrypt executable(s) found!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
function check_file() {
|
function check_file() {
|
||||||
local checksum="$(sha512sum "${1}" | grep -Po '^\s*\K\w+')"
|
local checksum="$(sha512sum "${1}" | grep -Eo '^[[:alnum:]]+' | tr 'A-Z' 'a-z' | head -n 1)"
|
||||||
if [ "${checksum,,}" != "${2,,}" ]; then
|
if [ "${checksum}" != "${2}" ]; then
|
||||||
echo "Error: Checksum of \"${1}\" does not match !!!"
|
echo "Error: Checksum of file \"${1}\" does not match !!!"
|
||||||
echo "-> Expected: ${2,,}"
|
echo "-> Expected: ${2}"
|
||||||
echo "-> Computed: ${checksum,,}"
|
echo "-> Computed: ${checksum}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "Checksum is correct."
|
echo "Checksum of file \"${1}\" is correct."
|
||||||
}
|
}
|
||||||
|
|
||||||
for suffix in i686 x86_64; do
|
|
||||||
if [ ! -x ./slunkcrypt-${suffix} ]; then
|
|
||||||
echo "Required program file \"slunkcrypt-${suffix}\" not found !!!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo -e "\n------------------------------------------------------------------------------"
|
echo -e "\n------------------------------------------------------------------------------"
|
||||||
echo "Clean up"
|
echo "Clean up"
|
||||||
echo -e "------------------------------------------------------------------------------\n"
|
echo -e "------------------------------------------------------------------------------\n"
|
||||||
|
|
||||||
rm -vf "test-vectors.tar" "passphrase.txt" "sha512sums.txt"
|
rm -vf test-vectors.tar passphrase.txt sha512sums.txt
|
||||||
rm -vf "test-"*"."{enc,png}
|
rm -vf test-*.enc rm -vf restored-*.png
|
||||||
|
|
||||||
echo -e "\n------------------------------------------------------------------------------"
|
echo -e "\n------------------------------------------------------------------------------"
|
||||||
echo "Download"
|
echo "Download"
|
||||||
@ -42,28 +39,21 @@ check_file "test-v100-2.enc" "a0e97b8e0b78a2fde215eb7234cff253e4af5b9ae426aaebfa
|
|||||||
check_file "test-v130-1.enc" "c13e6e001b08efba58909beed952957ea245a6f7fe52ad7022265f25f6f3a1c74423922f46cf171f2b23f948e4fde7004d83c89f95b62f825ff262cc7468bb48"
|
check_file "test-v130-1.enc" "c13e6e001b08efba58909beed952957ea245a6f7fe52ad7022265f25f6f3a1c74423922f46cf171f2b23f948e4fde7004d83c89f95b62f825ff262cc7468bb48"
|
||||||
check_file "test-v130-2.enc" "48fe6ce4b82fb1c132d987b95576b6856deb43031047f669434347d9ffb8bc79a636e59548ffa18bd8031fbaeb034cb972a147087f49a61bf53a6b740434f3c6"
|
check_file "test-v130-2.enc" "48fe6ce4b82fb1c132d987b95576b6856deb43031047f669434347d9ffb8bc79a636e59548ffa18bd8031fbaeb034cb972a147087f49a61bf53a6b740434f3c6"
|
||||||
|
|
||||||
echo -e "\n------------------------------------------------------------------------------"
|
while IFS= read -r name; do
|
||||||
echo "Decrypt"
|
echo -e "\n------------------------------------------------------------------------------"
|
||||||
echo -e "------------------------------------------------------------------------------\n"
|
echo "${name}"
|
||||||
|
echo -e "------------------------------------------------------------------------------\n"
|
||||||
|
|
||||||
for suffix in i686 x86_64; do
|
SLUNK_LEGACY_COMPAT=1 ./${name} -d 'pass:Q8YRL4_SFGt9m(>I,(h=fDaw' "test-v100-1.enc" "restored-v100-1.${name}.png"
|
||||||
SLUNK_LEGACY_COMPAT=1 ./slunkcrypt-${suffix} -d 'pass:Q8YRL4_SFGt9m(>I,(h=fDaw' "test-v100-1.enc" "test-v100-1-${suffix}.png"
|
SLUNK_LEGACY_COMPAT=1 ./${name} -d 'pass:1$SfiHiQW*G|RbpR8trFR$sp' "test-v100-2.enc" "restored-v100-2.${name}.png"
|
||||||
SLUNK_LEGACY_COMPAT=1 ./slunkcrypt-${suffix} -d 'pass:1$SfiHiQW*G|RbpR8trFR$sp' "test-v100-2.enc" "test-v100-2-${suffix}.png"
|
SLUNK_LEGACY_COMPAT=0 ./${name} -d 'pass:Q8YRL4_SFGt9m(>I,(h=fDaw' "test-v130-1.enc" "restored-v130-1.${name}.png"
|
||||||
SLUNK_LEGACY_COMPAT=0 ./slunkcrypt-${suffix} -d 'pass:Q8YRL4_SFGt9m(>I,(h=fDaw' "test-v130-1.enc" "test-v130-1-${suffix}.png"
|
SLUNK_LEGACY_COMPAT=0 ./${name} -d 'pass:1$SfiHiQW*G|RbpR8trFR$sp' "test-v130-2.enc" "restored-v130-2.${name}.png"
|
||||||
SLUNK_LEGACY_COMPAT=0 ./slunkcrypt-${suffix} -d 'pass:1$SfiHiQW*G|RbpR8trFR$sp' "test-v130-2.enc" "test-v130-2-${suffix}.png"
|
|
||||||
done
|
|
||||||
|
|
||||||
echo -e "\n------------------------------------------------------------------------------"
|
for i in 100 130; do
|
||||||
echo "Verify checksums"
|
for j in {1..2}; do
|
||||||
echo -e "------------------------------------------------------------------------------\n"
|
check_file "restored-v${i}-${j}.${name}.png" "658a566d279070546dcb385f0ae1f236058edfe246caaaa149b8de448b788616cf78f229af7e70c3a06a23b649540aa5f53927f9a959a957b9b8b0ddf25063b1"
|
||||||
|
|
||||||
for suffix in i686 x86_64; do
|
|
||||||
for version_number in 100 130; do
|
|
||||||
for i in {1..2}; do
|
|
||||||
check_file "test-v${version_number}-${i}-${suffix}.png" "658a566d279070546dcb385f0ae1f236058edfe246caaaa149b8de448b788616cf78f229af7e70c3a06a23b649540aa5f53927f9a959a957b9b8b0ddf25063b1"
|
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
done
|
done < <(find . -maxdepth 1 -type f -perm /111 -name 'slunkcrypt*' -exec basename "{}" \; | sed -e 's/^[[:blank:]]*//;s/[[:blank:]]*$//' -e '/^$/d')
|
||||||
|
|
||||||
echo -e "\nEverything completed successfully."
|
echo -e "\nEverything completed successfully.\n"
|
||||||
printf "\n"
|
|
||||||
|
Loading…
Reference in New Issue
Block a user