Skip to content

Instantly share code, notes, and snippets.

@BlueDrink9
Created January 12, 2025 07:10
Show Gist options
  • Save BlueDrink9/f0c14df5735e5e56ced546aed7a39778 to your computer and use it in GitHub Desktop.
Save BlueDrink9/f0c14df5735e5e56ced546aed7a39778 to your computer and use it in GitHub Desktop.
Extract iCloud passwords to csv on Windows (without Mac)

This script automates the extraction of icloud passwords on windows into a passwords.csv file, using Autohotkey to go through the entries, copy them to the clipboard with keyboard shortcuts, and write them to file.

Usage:

  1. Download and install icloud from the windows store. Do not open it yet.
  2. Once installed, run it as administrator for the first time, until you are signed in. (This fixes a bug where icloud says it is still initialising, every time you try to log in).
  3. Close icloud, then run it as a regular user. Open the keychain/passwords section in a new window.
  4. Download and install Autohotkey v1
  5. Download extract.ahk and run it with autohotkey
  6. Focus the icloud password window, at the first item.
  7. Press ctrl+shift+c
  8. The script will copy the url, username and password from each entry
  9. When the script gets to the last entry, kill the script in the taskbar
  10. Extracted passwords are in passwords.csv in the same folder as the script. The last entry may have multiple lines, so remove the excess.

This script is released as-is under the MIT licence. I cannot provide extra advice or support for this, it might not work by the time you try it. I wrote it as a once-off for a friend, and upload it in the hopes it might be useful, since there are no other solutions to this available online.

SendMode Input
^+c:: ; Ctrl+Shift+C to start
; Set the path for the CSV file where data will be stored
filePath := A_scriptdir . "\passwords.csv"
; Open the CSV file for writing (or create if doesn't exist)
; Write headers if the file is new
IfNotExist, %filePath%
{
FileAppend,
(
Website,Username,Password`n
), %filePath%
}
; Loop to collect multiple website, username and password pairs
Loop
{
; Wait for the website field to be focused and copy the website
Send, ^w ; Ctrl+W to copy the website
clipboard := ""
ClipWait
Sleep, 500 ; Give the clipboard time to process
website := clipboard
; Use website as the name
name := website
; Move to the username field and copy the username
Send, ^u ; Ctrl+U to copy the username
ClipWait
Sleep, 500 ; Give the clipboard time to process
username := clipboard
; Move to the password field and copy the password
Send, ^p ; Ctrl+P to copy the password
ClipWait
Sleep, 500 ; Give the clipboard time to process
password := clipboard
; Append the website (used as name), username and password to the CSV file
FileAppend,
(
%website%,%username%,%password%`n
), %filePath%
send {down}
}
Return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment