Last active
November 22, 2016 18:55
-
-
Save ericboehs/e91343bdf2063d76fa717d2087dde283 to your computer and use it in GitHub Desktop.
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
#! /usr/bin/env bash | |
export [email protected] | |
export APPLE_PASS=password1 | |
export AUTH_PLIST=$(curl -su "$APPLE_USER:$APPLE_PASS" "https://setup.icloud.com/setup/authenticate/$APPLE_USER") | |
export DSID=$(/usr/libexec/PlistBuddy -c "Print appleAccountInfo:dsid" /dev/stdin <<< $AUTH_PLIST) | |
echo $DSID | |
export TEMP_MME_AUTH_TOKEN=$(/usr/libexec/PlistBuddy -c "Print tokens:mmeAuthToken" /dev/stdin <<< $AUTH_PLIST) | |
echo $TEMP_MME_AUTH_TOKEN | |
# It seems this step is unnecessary as the mme auth tokens are the same | |
# export SETTINGS_PLIST=$(curl -su "$DSID:$TEMP_MME_AUTH_TOKEN" "https://setup.icloud.com/setup/get_account_settings") | |
# echo $SETTINGS_PLIST | |
# export MME_AUTH_TOKEN=$(/usr/libexec/PlistBuddy -c "Print tokens:mmeAuthToken" /dev/stdin <<< $SETTINGS_PLIST) | |
# echo $MME_AUTH_TOKEN | |
export MME_AUTH_TOKEN=$TEMP_MME_AUTH_TOKEN | |
export TOKEN=$(echo "$DSID:$MME_AUTH_TOKEN" | base64) | |
echo $TOKEN | |
curl -X PROPFIND https://p01-caldav.icloud.com -H "Depth: 1" -H "Authorization: X-MobileMe-AuthToken $TOKEN" \ | |
--data '<d:propfind xmlns:d="DAV:"><d:prop><d:current-user-principal /></d:prop></d:propfind>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Unfortunately this doesn't work with 2fa. If you use a app-specific password for line 6 you get a 401. If you use your actual password you get a 409.
I've looked at iCloud.com auth for two-step and can't find this mme token.
Here's some resources I've found about 2fa and the mme token: