Skip to content

Instantly share code, notes, and snippets.

View bufordtaylor's full-sized avatar

Buford Taylor bufordtaylor

View GitHub Profile
@bufordtaylor
bufordtaylor / icloud-caldav.rb
Created October 27, 2016 16:51 — forked from ericboehs/icloud-caldav.rb
Interface with Apple's iCloud CalDav Calendars
require 'rexml/document'
require 'rexml/xpath'
require 'http'
require 'icalendar'
HTTP::Request::METHODS = HTTP::Request::METHODS + [:report]
module AppleCalDav
class Client
attr_accessor :username, :password
#! /usr/bin/env bash
export APPLE_USER=user@example.com
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)