Last active
June 26, 2024 22:30
-
-
Save gzxu/00121e79d6503892b29960e8985288e4 to your computer and use it in GitHub Desktop.
Unlock an SED-supporting SSD with sedutil Hardware Encryption
This file contains 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
device=sdb | |
serial="$(ls -la /dev/disk/by-id | grep "/$device\$" | sed 's/ /\n/g' | grep ata | sed 's/_/\n/g' | tail -n1)" | |
read -r -s password | |
hashed=$(SERIAL="$serial" PASSWORD="$password" python3 -c 'import hashlib, base64, os; print(base64.b64encode(hashlib.pbkdf2_hmac("sha1", os.environ["PASSWORD"].encode(), os.environ["SERIAL"].ljust(20, " ").encode(), 75000, 32)).decode())' | base64 -d) | |
sudo sedutil-cli -n --listLockingRanges "$hashed" /dev/$device |
This file contains 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
read -s -p Password: password && sudo sedutil-cli --setLockingRange 0 rw "$password" /dev/sda && sudo sedutil-cli --setMBRDone on "$password" /dev/sda |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment