diff --git a/ps3_decrypt.sh b/ps3_decrypt.sh new file mode 100644 index 0000000..1a34647 --- /dev/null +++ b/ps3_decrypt.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +TODO_DIR="/home/$USER/Downloads/PS3/PS3ISO/" +DONE_DIR="/home/$USER/Downloads/PS3/PS3ISO/READY/" + +if [ ! -d "$TODO_DIR" ]; then + mkdir "$TODO_DIR" +fi + +if [ ! -d "$DONE_DIR" ]; then + mkdir "$DONE_DIR" +fi + +if [[ $# -eq 0 ]]; then + set -- *.zip +fi + +for file in "$@" +do + if [[ ! "$file" =~ \.zip$ ]]; then + continue + fi + + if [[ "$file" == "-d" ]] || [[ "$file" == "--keep" ]] || [[ "$file" == "-k" ]]; then + delete_zip=false + shift + continue + fi + + if [[ "$file" == "-dkey="* ]]; then + dkey=$(echo "$file" | cut -d= -f2) + shift + continue + fi + + extracted_file=$(zipinfo -1 "$file" "*.iso" | grep -i '\.iso$') + unzip -j -o -q "$file" "*.iso" -d "$TODO_DIR" + + clear + filename=$(basename "$extracted_file") + done_file="$DONE_DIR/$filename" + + if [[ -n "$dkey" ]]; then + if libray -i "$extracted_file" -o "$done_file" -k "$dkey"; then + echo "File processed successfully" + rm -rf "$extracted_file" + rm -rf "$dkey" + rename 's/ \(.*\)//' "$done_file" + else + echo "Error processing file" + fi + else + if libray -i "$extracted_file" -o "$done_file"; then + echo "File processed successfully" + rm -rf "$extracted_file" + rename 's/ \(.*\)//' "$done_file" + else + echo "Error processing file" + fi + fi + + if [[ "$delete_zip" != "false" ]]; then + rm -rf "$file" + fi +done \ No newline at end of file