Follow these detailed steps to automate extraction of iCloud session cookies from Chrome profiles and schedule automatic email generation.
- Prerequisites
- Installation
- Initial Configuration
- Running the Application
- Advanced Configuration
- Troubleshooting
- Maintaining the System
Before starting, ensure you have:
- Python 3.7+ installed on your system
- Google Chrome with active iCloud logins on multiple profiles
- iCloud+ subscription on each account (required for Hide My Email functionality)
- Git installed for cloning repositories
- Administrator/sudo privileges (required for Chrome cookie access)
- Windows, macOS, or Linux operating system
# Create project directory
mkdir icloud-email-bot
cd icloud-email-bot
# Create required subdirectories
mkdir -p logs sessions profiles# Create virtual environment
python -m venv venv
# Activate virtual environment
# On macOS/Linux:
source venv/bin/activate# Clone the hidemyemail-generator repo
git clone https://github.com/username/hidemyemail-generator.git
# Create our project files
touch main.py extract_cookies.py scheduler.py generator_client.py config.json requirements.txtCopy the following content to the requirements.txt file:
requests==2.31.0
schedule==1.2.0
cryptography==41.0.3
pycryptodome==3.19.0
pywin32==306; sys_platform == 'win32'
colorama==0.4.6
rich==13.5.2
pip install -r requirements.txtCopy and paste the code for each of the following files from the provided implementation:
extract_cookies.py- Cookie extraction modulegenerator_client.py- Hide My Email generator integrationscheduler.py- Task scheduling systemmain.py- Main console applicationconfig.json- Configuration file (or let the application create it)
You can either manually create a config.json file with the following template or let the application auto-detect profiles:
{
"profiles": [
{
"name": "Profile 1",
"path": "PATH_TO_CHROME_PROFILE_1",
"id": "profile1"
},
{
"name": "Profile 2",
"path": "PATH_TO_CHROME_PROFILE_2",
"id": "profile2"
}
],
"email_limit_per_hour": 5,
"refresh_interval_minutes": 60
}Replace PATH_TO_CHROME_PROFILE_X with the actual path to your Chrome profiles:
- macOS:
/Users/YourUsername/Library/Application Support/Google/Chrome/Profile X
For each Chrome profile in your configuration:
- Open Chrome with that specific profile
- Navigate to
https://www.icloud.com/ - Ensure you are logged in to an iCloud account with iCloud+ subscription
- Verify that Hide My Email is available in the account settings
- Close Chrome completely before running the bot
Start the application in interactive mode to configure and test:
python main.py-
Select option 5 to configure profiles
- Choose option 4 to auto-detect Chrome profiles
- Confirm the profiles that are detected
-
Select option 3 to run jobs immediately
- This will test cookie extraction and email generation
- Review the output for any errors
-
Select option 4 to view the status
- Check that cookies were successfully extracted
- Verify if any emails were generated
To specifically test cookie extraction without starting the scheduler:
- Ensure Chrome is completely closed
- In the main menu, select option 3 to run jobs now
- Check the logs directory for detailed logs:
cat logs/bot.log | grep "cookie"
Once you've confirmed everything works:
- From the main menu, select option 1 to start the scheduler
- The application will now run on the configured schedule
- You can view the status at any time by selecting option 4
For 24/7 operation without the interactive interface:
python main.py --daemonConsider setting up a system service or using tools like screen, tmux, or nohup to keep the process running:
# Using nohup
nohup python main.py --daemon > daemon.log 2>&1 &
# Using screen
screen -S email-bot
python main.py --daemon
# Press Ctrl+A, then D to detach-
Save the script to your computer as extract_icloud_cookies.py
-
Make it executable:
chmod +x extract_icloud_cookies.py
- Run it with options:
- List available Chrome profiles:
python extract_icloud_cookies.py --list-profiles
- Extract cookies from the default profile:
python extract_icloud_cookies.py --output icloud_cookies.json
- Extract cookies from a specific profile:
python extract_icloud_cookies.py --profile "Profile 1" --output profile1_cookies.json
- Verify the output file contains the necessary cookies:
- X-APPLE-WEBAUTH-HSA-TRUST
- X-APPLE-ID-SESSION-ID
- X-APPLE-WEBAUTH-USER
- dsid
- scnt
- X-APPLE-ID-TOKEN
Edit config.json to change the refresh interval:
{
"refresh_interval_minutes": 30
}Configure how many emails to generate per profile per hour:
{
"email_limit_per_hour": 3
}Run the application with a custom configuration file:
python main.py --config custom_config.jsonTo deploy on multiple systems:
- Copy the entire project directory
- On each system, run the application with auto-detection:
python main.py
- Use option 5 → 4 to auto-detect the system's Chrome profiles
- Configure the scheduler as needed
Issue: "Failed to extract cookies" error
Solutions:
-
Ensure Chrome is completely closed during extraction
# On Windows taskkill /F /IM chrome.exe # On macOS killall "Google Chrome" # On Linux pkill -f chrome
-
Verify profile paths are correct
# Check file existence on Windows dir "C:\Users\YourUsername\AppData\Local\Google\Chrome\User Data\Profile 1\Cookies" # Check on macOS/Linux ls -la ~/Library/Application\ Support/Google/Chrome/Profile\ 1/Cookies
-
Check permissions
# Run with elevated privileges on Windows # Run Command Prompt as Administrator and then run the script # On macOS/Linux sudo python main.py
Issue: "Decryption failed" or "Could not decrypt cookie value"
Solutions:
- Ensure you're using the same user account that created the cookies
- On macOS, check keychain access:
security find-generic-password -a Chrome
- On Windows, verify the Local State file exists:
dir "C:\Users\YourUsername\AppData\Local\Google\Chrome\User Data\Local State"
Issue: "Failed to generate email" error
Solutions:
- Verify cookies are valid by checking extraction logs
- Ensure the hidemyemail-generator is properly configured:
cd hidemyemail-generator python main.py --help - Check if the iCloud account has an active iCloud+ subscription
- Verify Apple's services aren't down or rate-limiting your requests
-
Update dependencies periodically:
pip install --upgrade -r requirements.txt
-
Backup your configuration:
cp config.json config.json.backup
-
Clear old logs to prevent disk space issues:
# Delete logs older than 7 days find logs -type f -name "*.log" -mtime +7 -delete
-
Periodic login refreshes:
- Every few weeks, log into each iCloud account in Chrome
- This helps prevent session expirations
-
Check application logs:
tail -f logs/bot.log
-
View generated emails through the UI:
python main.py # Select option 6 -
Check process status when running in daemon mode:
ps aux | grep "python main.py --daemon"
-
Restrict access to the project directory:
# On macOS/Linux chmod 700 -R icloud-email-bot/ -
Encrypt sensitive files when not in use:
# Example using GPG gpg -c sessions/profile1.json -
Run on a private network to prevent unauthorized access
-
Use a dedicated user account for running the bot in production environments
By following this guide, you should have a fully functional iCloud Hide My Email generator bot running on your system. For any issues not covered in the troubleshooting section, check the logs for detailed error messages and consider filing an issue on the project repository.