def tokenFactory(authCode):
#now that we have proper b64 encoded auth code, we will attempt to get all account tokens.
try:
req = urllib2.Request("https://setup.icloud.com/setup/get_account_settings")
req.add_header('Authorization', 'Basic %s' % authCode)
req.add_header('Content-Type', 'application/xml') #for account settings it appears we cannot use json. type must be specified.
req.add_header('X-MMe-Client-Info', '<iPhone6,1> <iPhone OS;9.3.2;13F69> <com.apple.AppleAccount/1.0 (com.apple.Preferences/1.0)>') #necessary header to get tokens.
resp = urllib2.urlopen(req)
content = resp.read()
tokens = []
#staple it together & call it bad weather
accountInfo = []
accountInfo.append(plistlib.readPlistFromString(content)["appleAccountInfo"]["fullName"] + " | " + plistlib.readPlistFromString(content)["appleAccountInfo"]["appleId"] + " | " + plistlib.readPlistFromString(content)["appleAccountInfo"]["dsPrsID"])
try:
tokens.append(plistlib.readPlistFromString(content)["tokens"]["mmeAuthToken"])
except:
pass
try:
tokens.append(plistlib.readPlistFromString(content)["tokens"]["cloudKitToken"])
except:
pass
try:
tokens.append(plistlib.readPlistFromString(content)["tokens"]["mmeFMFAppToken"])
except:
pass
try:
tokens.append(plistlib.readPlistFromString(content)["tokens"]["mmeFMIPToken"])
except:
pass
try:
tokens.append(plistlib.readPlistFromString(content)["tokens"]["mmeFMFToken"])
except:
pass
return (tokens, accountInfo)
except Exception, e:
return '%s' % e
评论列表
文章目录