Created
January 31, 2017 16:07
-
-
Save tsmolka/bff25dcabfb98f55131f0dee91e6f2d1 to your computer and use it in GitHub Desktop.
Quick & dirty script for decrypting HP Bios passwords created by HpqPswd.exe
This file contains hidden or 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
| import argparse, struct | |
| from Crypto.Cipher import AES | |
| if __name__ == '__main__': | |
| parser = argparse.ArgumentParser(description='HpqPswd Decryptor') | |
| parser.add_argument('-f', '--file', required=True, help='Input file') | |
| parser.add_argument('-k', '--key', default='4a14........................................................1e33') | |
| args = parser.parse_args() | |
| f = open(args.file, 'rb') | |
| if f.read(8) != '_HPPW12_': | |
| raise Exception('Wrong magic') | |
| cipher = AES.new(args.key.decode('hex'), AES.MODE_CBC, '\0'*AES.block_size) | |
| length, = struct.unpack('<H', f.read(2)) | |
| print cipher.decrypt(f.read(length)) |
Author
Please make sure you are passing correct key as an argument.
Hi Tobias, I have an old HP Omnibook 300 that is password-locked. When I press Shift-F10 I get a scrambled version of the password. However HP can't descramble it due to this being an old laptop from 1993. Do you know how I could go about descrambling the password on this old machine? Thanks!
Author
@accelerate-science , this script is for decrypting files that start with magic string HPPW12. Similar to the process in this writeup: https://www.serializing.me/2016/10/15/hpqpswd-encrypted-passwords-decryption/. I don't think it will apply to your situation.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For some reason, I am getting "TypeError: Non-hexadecimal digit found" when I try to decrypt the file.
Has the format of the file changed?