Created
August 27, 2020 04:24
-
-
Save pavgup/ef9eeceebec1ef71bf438bb67486284a to your computer and use it in GitHub Desktop.
programmatically extracting a bunch of files that have been mangled with ciphercloud
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
# This script looks for the first argument to be in single quotes and relative to the base (and obviously a ccsecure file!) | |
# CipherCloud is annoying, but not hard. Lets manipulate this to extract! | |
open /Applications/CipherCloud.app "$1" | |
# Lets find the parent directory for each file, to place the extracted file after done | |
parentdir="$(dirname "$1")" | |
# We don't need this variable below, but lets just make things simple and get the filename too | |
filename="$(basename "$1")" | |
# Lets get the filename without ccsecure so we can find it in the weird temp directory CipherCloud uses | |
fileWithoutCCSECURE="${filename%.*}" | |
# You are not pgupta3, I think. Change pgupta3 below into something. Or refactor this with a username variable, yawn. | |
cipherCloudPath="/Users/pgupta3/Library/Containers/com.ciphercloud.macapp.CipherCloud/Data/Library/Caches/com.ciphercloud.macapp.CipherCloud/originalFile" | |
# The extracted file will show up here: | |
fullDecipheredPath=$cipherCloudPath/$fileWithoutCCSECURE | |
# Want to see what the variables are defined as? Uncomment this. | |
# echo $parentdir | |
# echo $filename | |
# echo $fileWithoutCCSECURE | |
# echo $fullDecipheredPath | |
# And somehow ciphercloud and some app and something else take forever, so lets just sleep for 15 seconds | |
sleep 15 | |
# Lets move the full deciphered path to the directory next to the ccsecure file | |
mv "$fullDecipheredPath" "$parentdir" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment