Skip to content

Instantly share code, notes, and snippets.

@pavgup
Created August 27, 2020 04:24
Show Gist options
  • Save pavgup/ef9eeceebec1ef71bf438bb67486284a to your computer and use it in GitHub Desktop.
Save pavgup/ef9eeceebec1ef71bf438bb67486284a to your computer and use it in GitHub Desktop.
programmatically extracting a bunch of files that have been mangled with ciphercloud
#/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