23 lines
856 B
Bash
Executable File
23 lines
856 B
Bash
Executable File
|
|
#!/bin/bash
|
|
|
|
# Check if the user provided a file name as an argument
|
|
if [ $# -eq 0 ]; then
|
|
echo "Expected usage: decrypt.sh <filename>"
|
|
exit 1
|
|
fi
|
|
|
|
# Store the provided filename in a variable
|
|
file_name="$1"
|
|
|
|
# Check if the provided argument is a file and not a folder
|
|
if [ ! -f "/home/ctf-player/drop-in/$file_name" ]; then
|
|
echo "Error: '$file_name' is not a valid file. Look inside the 'files' folder with 'ls -R'!"
|
|
exit 1
|
|
fi
|
|
|
|
# If there's an error reading the file, print an error message
|
|
if ! openssl enc -d -aes-256-cbc -pbkdf2 -iter 100000 -salt -in "/home/ctf-player/drop-in/$file_name" -k picoCTF; then
|
|
echo "Error: Failed to decrypt '$file_name'. This flag is fake! Keep looking!"
|
|
fi
|
|
|