Created
June 8, 2023 18:59
-
-
Save NyaMisty/199a5bcf4b9f3b6c8d18bcabee9a2dc0 to your computer and use it in GitHub Desktop.
Login additional account on MacOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
@interface AMSBag : NSObject {} | |
+(id)bagForProfile:(id)arg1 profileVersion:(id)arg2 ; | |
+(id)bagForProfile:(id)arg1 profileVersion:(id)arg2 processInfo:(id)arg3 ; | |
-(NSString *)URLForKey:(NSString *)key; | |
@end | |
@interface ACAccount : NSObject {} | |
@end | |
@interface AMSProcessInfo : NSObject {} | |
- (id)initWithBundleIdentifier:(NSString *)arg1; | |
@end | |
@interface AMSURLRequestEncoder : NSObject {} | |
+(id)bagSubProfileVersion; | |
+(id)bagSubProfile; | |
+(id)bagKeySet; | |
+(id)createBagForSubProfile; | |
+(void)addRequiredBagKeysToAggregator:(id)arg1 ; | |
-(long long)encodeCount; | |
-(void)setBag:(id)arg1 ; | |
-(void)setResponseDecoder:(id)arg1 ; | |
-(NSObject*)internalQueue; | |
-(id)responseDecoder; | |
-(void)setInternalQueue:(NSObject*)arg1 ; | |
-(id)bag; | |
-(BOOL)includeClientVersions; | |
-(void)setLogUUID:(NSString *)arg1 ; | |
-(id)initWithBagContract:(id)arg1 ; | |
-(void)setIncludeClientVersions:(BOOL)arg1 ; | |
-(NSString *)logUUID; | |
-(id)requestWithMethod:(long long)arg1 URLString:(id)arg2 parameters:(id)arg3 error:(id*)arg4 ; | |
-(id)requestWithMethod:(long long)arg1 bagURL:(id)arg2 error:(id*)arg3 ; | |
-(id)initWithBag:(id)arg1 ; | |
-(void)setAnisetteType:(long long)arg1 ; | |
-(void)setCompressRequestBody:(BOOL)arg1 ; | |
-(void)setShouldSetStorefrontFromResponse:(BOOL)arg1 ; | |
-(id)requestByEncodingRequest:(id)arg1 parameters:(id)arg2 error:(id*)arg3 ; | |
-(void)setEnableRemoteSecuritySigning:(BOOL)arg1 ; | |
-(void)setEncodeCount:(long long)arg1 ; | |
-(void)setRequestEncoding:(long long)arg1 ; | |
-(long long)mescalType; | |
-(void)setAccount:(ACAccount *)arg1 ; | |
-(ACAccount *)account; | |
-(void)_addSecuritySigningHeadersToRequest:(id)arg1 buyParams:(id)arg2 bag:(id)arg3 ; | |
-(long long)requestEncoding; | |
-(id)requestWithMethod:(long long)arg1 URL:(id)arg2 parameters:(id)arg3 ; | |
-(void)setBagContract:(id)arg1 ; | |
-(void)setDialogOptions:(long long)arg1 ; | |
-(BOOL)disableResponseDecoding; | |
-(id)init; | |
-(id)bagContract; | |
-(id)_methodStringFromMethod:(long long)arg1 ; | |
-(id)requestWithMethod:(long long)arg1 bagURL:(id)arg2 parameters:(id)arg3 error:(id*)arg4 ; | |
-(NSDictionary *)additionalMetrics; | |
-(void)setDataEncoding:(long long)arg1 ; | |
-(void)setMescalType:(long long)arg1 ; | |
-(AMSProcessInfo *)clientInfo; | |
-(void)setShouldSetCookiesFromResponse:(BOOL)arg1 ; | |
-(BOOL)shouldSetStorefrontFromResponse; | |
-(id)requestWithMethod:(long long)arg1 bagURL:(id)arg2 parameters:(id)arg3 ; | |
-(BOOL)enableRemoteSecuritySigning; | |
-(void)setParentTask:(NSURLSessionTask *)arg1 ; | |
-(void)setDisableResponseDecoding:(BOOL)arg1 ; | |
-(long long)dialogOptions; | |
-(BOOL)shouldSetCookiesFromResponse; | |
-(id)requestWithMethod:(long long)arg1 URLString:(id)arg2 error:(id*)arg3 ; | |
-(long long)dataEncoding; | |
-(void)setAdditionalMetrics:(NSDictionary *)arg1 ; | |
-(BOOL)urlKnownToBeTrusted; | |
-(long long)anisetteType; | |
-(id)requestWithMethod:(long long)arg1 URL:(id)arg2 parameters:(id)arg3 error:(id*)arg4 ; | |
-(void)setUrlKnownToBeTrusted:(BOOL)arg1 ; | |
-(id)requestByEncodingRequest:(id)arg1 parameters:(id)arg2 ; | |
-(BOOL)compressRequestBody; | |
-(void)setClientInfo:(AMSProcessInfo *)arg1 ; | |
-(NSURLSessionTask *)parentTask; | |
-(id)requestWithMethod:(long long)arg1 URL:(id)arg2 error:(id*)arg3 ; | |
@end | |
@interface CKStoreClient : NSObject {} | |
+ (id)storeClientForIdentifier:(id)arg1; | |
+ (id)storeClientForAccount:(id)arg1; | |
+ (id)storeClientForIdentifier:(id)arg1 serverType:(long long)arg2; | |
- (id)_legacyStoreClient; | |
@end | |
extern NSString *CKMacAppStoreClientIdentifier; | |
@interface ISAuthenticationContext : NSObject {} | |
- (id)initWithAccountID:(id)arg1; | |
- (id)init; | |
@property long long authenticationStyle; // @synthesize authenticationStyle=_style; | |
@property(retain) NSDictionary *dialogDictionary; // @synthesize dialogDictionary=_dialogDictionary; | |
@property long long authenticationReason; // @synthesize authenticationReason=_authenticationReason; | |
@end | |
@interface ISServiceProxy : NSObject {} | |
- (id)initWithStoreClient:(id)arg1; | |
- (id)transactionServiceWithErrorHandler:(id)arg1; | |
@end | |
@interface ISTransactionService : NSObject {} | |
- (void)dsidByAuthenticatingWithContext:(id)arg1 replyBlock:(id)arg2; | |
@end | |
@interface ACAccountStore : NSObject {} | |
@property (nonatomic, readonly) NSArray *accounts; | |
@property (nonatomic, readonly) NSArray *ams_iTunesAccounts; | |
+ (id)ams_sharedAccountStore; | |
@end | |
@interface SSAccountStore : NSObject {} | |
@property (readonly, copy) NSArray *accounts; | |
+ (id)defaultStore; | |
@end | |
int main() { | |
// 1. Dump current account status | |
ACAccountStore *accountStoreAC = [ACAccountStore ams_sharedAccountStore]; | |
for (id account in accountStoreAC.accounts) { | |
NSLog(@"cur account: %@", account); | |
} | |
// Will trigger NSUnimplemented abort, for unknown reason | |
// SSAccountStore *accountStoreSS = [SSAccountStore defaultStore]; | |
// for (id account in accountStoreSS.accounts) { | |
// NSLog(@"cur account: %@", account); | |
// } | |
// 2. Authenticate, using system framework | |
CKStoreClient *storeClient = [CKStoreClient storeClientForIdentifier:CKMacAppStoreClientIdentifier]; | |
NSLog(@"storeClient: %@", storeClient); | |
ISAuthenticationContext *context = [[ISAuthenticationContext alloc] initWithAccountID:@123456]; | |
context.authenticationStyle = 2; | |
context.dialogDictionary = @{ | |
@"message": @"misty message", | |
@"explaination" : @"misty explaination", | |
}; | |
context.authenticationReason = 14; | |
ISServiceProxy *proxy = [[ISServiceProxy alloc] initWithStoreClient:[storeClient _legacyStoreClient]]; | |
ISTransactionService *transaction = [proxy transactionServiceWithErrorHandler:^(NSError *err) { | |
NSLog(@"got error %@", err); | |
}]; | |
[transaction dsidByAuthenticatingWithContext:context replyBlock:^(bool succ, NSNumber *dsid, NSError *err) { | |
NSLog(@"Got auth ret: %d %@ %@", succ, dsid, err); | |
if (succ) { | |
exit(0); | |
} else { | |
exit(1); | |
} | |
}]; | |
// 3. Authorize Machine (Seems not needed) | |
// AMSBag *bag = [AMSBag bagForProfile:@"appstored" profileVersion:@"1"]; | |
// NSLog(@"got bag: %@", bag); | |
// NSString *url = [bag URLForKey:@"authorizeMachine"]; | |
// NSLog(@"url: %@", url); | |
// AMSProcessInfo *info = [[AMSProcessInfo alloc] initWithBundleIdentifier:@"com.apple.AppStore"]; | |
// NSLog(@"got info: %@", info); | |
// AMSURLRequestEncoder *req = [[AMSURLRequestEncoder alloc] initWithBag:bag]; | |
// //[req setAccount: ]; | |
// [req setAnisetteType:2]; | |
// [req setClientInfo:info]; | |
// [req requestWithMethod:bagURL:parameters:] | |
CFRunLoopRun(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment