Add 'dislocker.sh'
This commit is contained in:
29
dislocker.sh
Normal file
29
dislocker.sh
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Variables
|
||||
bitlockerPartitionMountPoint="/mnt/bitlocker"
|
||||
dislockerFileMountPoint="/mnt/bitlocker/dislocker-file"
|
||||
unlockedBitlockerMountPoint="/mnt/unlockedBitlocker"
|
||||
|
||||
# get list of drives and find ones labeled with bitlocker
|
||||
bitlockerPartition=`dislocker-find`
|
||||
bitlockerRecoveryKeyID=`dislocker-metadata -V ${bitlockerPartition} | awk '/Recovery Key GUI:/ {print $10; exit}' | sed "s/'//g"`
|
||||
|
||||
# confirm drive
|
||||
|
||||
# make temp directories
|
||||
mkdir ${bitlockerPartitionMountPoint}
|
||||
mkdir ${unlockedBitlockerMountPoint}
|
||||
|
||||
# ask for the recovery key with dashses
|
||||
read -p "Enter recovery key with dashes for bitlocker recovery ID ${bitlockerRecoveryKeyID}: " bitlockerRecoveryKey
|
||||
|
||||
# try unlocking the drive
|
||||
dislocker -v -V ${bitlockerPartition} -p${bitlockerRecoveryKey} -- ${bitlockerPartitionMountPoint}
|
||||
|
||||
# test if the dislockerFileMountPoint was created
|
||||
if [ -f ${dislockerFileMountPoint} ]; then
|
||||
# mount the file
|
||||
mount -o loop,ro ${dislockerFileMountPoint} ${unlockedBitlockerMountPoint}
|
||||
echo "The drive was unlocked and is availabe at ${unlockedBitlockerMountPoint}"
|
||||
fi
|
||||
Reference in New Issue
Block a user