]>
git.saurik.com Git - apple/security.git/blob - keychain/ResetCloudKeychainAccount/reset_ick_account
11 parser
= argparse
.ArgumentParser(description
='Reset your iCloud Keychain account')
12 parser
.add_argument('icloudpassword', help='iCloud password')
13 parser
.add_argument('passcode', help='passcode or password of the local device')
14 args
= vars(parser
.parse_args())
17 iCloudPassword
= args
['icloudpassword']
18 passcode
= args
['passcode']
20 def set_security_mac_cmd():
23 def set_security_ios_cmd():
26 def security_cmd_by_platform():
27 swVers
= subprocess
.check_output(["sw_vers"])
28 deviceInformation
= str(swVers
, 'utf-8')
29 if "Mac OS X" in deviceInformation
:
30 print("using security2 command on macosx")
31 return set_security_mac_cmd()
32 elif "iPhone OS" in deviceInformation
:
33 print("using security command on ios")
34 return set_security_ios_cmd()
36 print("unsupported platform")
39 security_cmd
= security_cmd_by_platform()
41 print("resetting octagon")
42 subprocess
.check_output(["otctl", "resetoctagon"])
44 print("resetting ckks")
45 subprocess
.check_output(["ckksctl", "reset-cloudkit"])
47 print("resetting SOS")
48 subprocess
.check_output([security_cmd
, "sync", "-C"])
49 subprocess
.check_output([security_cmd
, "sync", "-P", "$iCloudPassword"])
50 subprocess
.check_output([security_cmd
, "sync", "-O"])
52 print("deleting all escrow records")
53 subprocess
.check_output(["stingrayutil", "--deleteAll", "ReallyDeleteAll"])
55 print("creating new escrow record")
56 subprocess
.check_output(["sbdtool", "passcode_request_trigger"])
57 subprocess
.check_output(["sbdtool", "passcode_request_provide_passcode", "$passcode"])