
The following code will connect to the database and do that operation for us. The tables that we are interested in is logins and the fields we need to fetch are origin_url, username_value, password_value. DatabaseĬhrome stores a website’s username and password in an SQLite database named Login Data. If you are a person who stores passwords in browsers, then this could be a little revelation to give you a reason why you should not leave your machine with someone else. Password_decryption() takes the encrypted password and AES key as parameters and returns the decrypted version or Human Readable format of the password.Let’s take our previous Python code that we used to analyze our browsing history and tinker it a bit to steal our own passwords from Chrome’s local storage. Return str(win32crypt.CryptUnprotectData(password, None, None, None, 0)) This function will be useful for the encrypted key.ĭef password_decryption(password, encryption_key):Ĭipher = AES.new(encryption_key, AES.MODE_GCM, iv) It is saved as a JSON file in “C:\Users\\AppData\Local\Google\Chrome\User Data\Local State”. The fetching_encryption_key() function obtains and decodes the AES key used to encrypt the password. # remove Windows Data Protection API (DPAPI) str # decoding the encryption key using base64

Local_state_data = json.loads(local_state_data) With open(local_computer_directory_path, "r", encoding="utf-8") as f: Os.environ, "AppData", "Local", "Google", Local_computer_directory_path = os.path.join( # Local => Google => Chrome => User Data => The chrome_date_and_time() function is responsible for converting Chrome’s date format into a human-readable date and time format.Ĭhrome Date and time format look like this: 'year-month-date hr:mins:seconds.milliseconds' Return datetime(1601, 1, 1) + timedelta(microseconds=chrome_data) # This will return datetime.datetime Object # year-month-date hr:mins:seconds.milliseconds


