XcodesOrg / xcodes

The best command-line tool to install and switch between multiple versions of Xcode.
MIT License
3.59k stars 119 forks source link

Remember 2FA code #317

Open 0xallie opened 9 months ago

0xallie commented 9 months ago

Would it be possible to utilize anisette data to remember the 2FA code and not prompt for it each time? It's pretty easy to get anisette on macOS with SIP/AMFI enabled, works even on macOS 14.0 RC.

#!/usr/bin/osascript -l JavaScript

ObjC.bindFunction('dlopen', ['void*', ['char*', 'int']]);
$.dlopen('/System/Library/PrivateFrameworks/AOSKit.framework/Versions/A/AOSKit', 0xa);
const AOSUtilities = $.NSClassFromString($.NSString.alloc.initWithUTF8String('AOSUtilities'));

const otp = AOSUtilities.retrieveOTPHeadersForDSID('-2');
JSON.stringify(ObjC.unwrap(otp.allKeys).reduce((o,k) => { o[ObjC.unwrap(k)] = ObjC.deepUnwrap(otp.valueForKey(k)); return o; }, {}));