Add 'dislocker.sh'

This commit is contained in:
2021-02-04 09:53:00 -05:00
parent d5f88521eb
commit 3e19ca6d26

29
dislocker.sh Normal file
View 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