Skip to content

Instantly share code, notes, and snippets.

@t-lark
Created July 8, 2020 23:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save t-lark/35366441efd6e5cc2adaf4c28355eedf to your computer and use it in GitHub Desktop.
Save t-lark/35366441efd6e5cc2adaf4c28355eedf to your computer and use it in GitHub Desktop.
#!/opt/bin/snowflake/python
"""
quick example code to grab what iCloud account is in use
"""
# import modules
from SystemConfiguration import SCDynamicStoreCopyConsoleUser
from CoreFoundation import CFPreferencesCopyAppValue
from Foundation import NSHomeDirectoryForUser
# global vars
USER, UID, GID = SCDynamicStoreCopyConsoleUser(None, None, None)
USERHOME = NSHomeDirectoryForUser(USER)
FILE = USERHOME + '/Library/Preferences/MobileMeAccounts.plist'
results = CFPreferencesCopyAppValue("Accounts", FILE)[0]['AccountID']
print(results)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment