Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #requirementes: dislocker,zenity
- DFILE_LOCATION="/tmp/DFILE"
- DRIVE_MOUNTPOINT="/mnt/UnlockedDrive"
- if ! type zenity > /dev/null; then
- echo "Please install 'Zenity'";
- exit;
- fi
- if ! type dislocker > /dev/null; then
- zenity --error --tittle="Dislocker Not Found" --text="Dislocker has not been found on your system. Please install, and retry."
- exit;
- fi
- #If everythng seems to be OK, continue.
- SUPASSWORD=$(zenity --password --title="Authenticate" --text="In order to continue, SuperUser Passwrod is required")
- #Check if exists, otherwise create a folder to mount dislocker-image
- if [ ! -d $DFILE_LOCATION ]; then
- # Control will enter here if $DIRECTORY doesn't exist.
- echo $SUPASSWORD | sudo -S mkdir $DFILE_LOCATION
- fi
- if [ ! -d $DRIVE_MOUNTPOINT ]; then
- # Control will enter here if $DIRECTORY doesn't exist.
- echo $SUPASSWORD | sudo -S mkdir $DRIVE_MOUNTPOINT
- fi
- lockedDrive=$(find /dev -mindepth 1 -maxdepth 1 -name "*[sh]d[a-z][0-9]" | sort | awk '{ printf "FALSE""\0"$0"\0" }' | \
- xargs -0 zenity --list --title="Root Partition" --text="Select the locked partition to unlock." \
- --radiolist --multiple --column ' ' --column 'Partitions')
- lockedDrivePSW=$(zenity --password --title="Locked Drive" --text="Please type Locked Drive Password")
- if [ ! -f "$DFILE_LOCATION"/dislocker-file ]; then
- # Control will enter here if file does not.
- echo $SUPASSWORD | sudo -S dislocker -v -V $lockedDrive -u$lockedDrivePSW -- $DFILE_LOCATION
- echo $SUPASSWORD | sudo -S mount -o loop $DIRECTORY_DFILE_LOCATION/dislocker-file $DRIVE_MOUNTPOINT
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement