Last active
August 29, 2015 14:02
-
-
Save ttwj/9a406fb1345e8adbe732 to your computer and use it in GitHub Desktop.
CanalTimes
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
// | |
// canaltimes.mm | |
// canaltimes | |
// | |
// CaptainHook by Ryan Petrich | |
// see https://github.com/rpetrich/CaptainHook/ | |
#import <Foundation/Foundation.h> | |
#import "CaptainHook/CaptainHook.h" | |
@interface SPHLoginManager : NSObject { | |
//UIButton* loginButton; | |
BOOL showForm; | |
NSMutableArray* loginDevices; | |
} | |
@property(retain, nonatomic) NSMutableArray* loginDevices; | |
@property(assign, nonatomic) BOOL showForm; | |
//@property(retain, nonatomic) UIButton* loginButton; | |
+(id)allocWithZone:(NSZone*)zone; | |
+(id)defaultManager; | |
-(void)onLoginToSPHCompleted:(id)sphcompleted; | |
-(void)loginToSPHServerAtStartup:(id)startup; | |
-(void)onApplicationDidBecomeActive; | |
-(void)checkSPHLoginAtStartup; | |
-(void)alertView:(id)view clickedButtonAtIndex:(int)index; | |
-(void)promptForLogin; | |
-(void)onLoginButtonPressed:(id)pressed; | |
-(void)onLogutToSPHCompleted:(id)sphcompleted; | |
-(void)logoutDevice:(id)device; | |
-(void)logout; | |
-(void)setHasAccess:(BOOL)access; | |
-(BOOL)hasAccess; | |
-(void)dealloc; | |
-(id)init; | |
-(id)autorelease; | |
-(oneway void)release; | |
-(unsigned)retainCount; | |
-(id)retain; | |
-(id)copyWithZone:(NSZone*)zone; | |
@end | |
@interface APIManagerResponse : NSObject { | |
int state; | |
id result; | |
//WebRequestObject* webRequestObject; | |
} | |
//@property(retain, nonatomic) WebRequestObject* webRequestObject; | |
@property(retain, nonatomic) id result; | |
@property(assign, nonatomic) int state; | |
+(id)APIManagerResponseWithResult:(id)result state:(int)state request:(id)request; | |
//-(void).cxx_destruct; | |
-(id)initWithResult:(id)result state:(int)state request:(id)request; | |
@end | |
@interface UIFloatingAdvertisementControl : NSObject { | |
BOOL isVisible; | |
BOOL isCancelled; | |
BOOL isLoading; | |
NSString* category; | |
NSString* section; | |
} | |
@property(retain, nonatomic) NSString* section; | |
@property(retain, nonatomic) NSString* category; | |
//@property(retain, nonatomic) Ad* _ad; | |
//@property(assign, nonatomic) BOOL isVisible; | |
//@property(retain, nonatomic) id<UIFloatingAdvertisementControlDelegate> delegate; | |
-(void)dealloc; | |
-(void)loadAd:(int)ad; | |
//-(id)initWithFrame:(CGRect)frame; | |
@end | |
CHDeclareClass(SPHLoginManager); // declare class | |
CHDeclareClass(APIManager); | |
CHOptimizedMethod0(self, id, APIManager, adServerPath) { | |
NSLog(@"capitalist scums"); | |
return (id) @"http://loe-roeprkefjeofjefjefjf/"; | |
} | |
CHOptimizedMethod1(self, void, SPHLoginManager, onLoginToSPHCompleted, id, sphcompleted) { | |
NSLog(@"login to SPH wow!"); | |
APIManagerResponse *response = (APIManagerResponse*) sphcompleted; | |
NSLog(@"state %u", response.state); | |
//NSLog(@"responsedcit: %@", response.result); | |
if ([response.result count] == 0) { | |
NSLog(@"response == 0"); | |
} | |
else { | |
NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys: | |
@"Success", @"Active", | |
@"Success", @"User-Password", | |
@"Success", @"Service", nil]; | |
response.result = dict; | |
} | |
CHSuper1(SPHLoginManager, onLoginToSPHCompleted, response); | |
} | |
CHOptimizedMethod1(self, void, SPHLoginManager, loginToSPHServerAtStartup, id, startup) { | |
NSLog(@"login at startup wow!"); | |
APIManagerResponse *response = (APIManagerResponse*) startup; | |
NSLog(@"data: %@", startup); | |
//NSLog(@"responsedcit: %@", response.result); | |
if ([response.result count] == 0) { | |
NSLog(@"response == 0"); | |
} | |
else { | |
NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys: | |
@"Success", @"Active", | |
@"Success", @"User-Password", | |
@"Success", @"Service", nil]; | |
response.result = dict; | |
} | |
CHSuper1(SPHLoginManager, onLoginToSPHCompleted, response); | |
} | |
CHConstructor // code block that runs immediately upon load | |
{ | |
@autoreleasepool | |
{ | |
CHLoadLateClass(SPHLoginManager); | |
NSLog(@"load class ok"); | |
CHHook(1, SPHLoginManager, loginToSPHServerAtStartup); | |
CHHook(1, SPHLoginManager, onLoginToSPHCompleted); | |
CHHook(0, APIManager, adServerPath); | |
NSLog(@"register hook ok"); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment