美文网首页
Hook-移动办公

Hook-移动办公

作者: tomatobin | 来源:发表于2016-06-28 18:38 被阅读186次

    这里给出核心的hook代码,具体见

    #import "CaptainHook.h"#import#import//Hook的class
    
    CHDeclareClass(AttendanceViewController);
    
    //Hook的函数
    
    //-(void)checkButton:(int)button;
    
    CHMethod(1, void, AttendanceViewController, checkButton, int, button)
    
    {
    
    if (button == 2) {
    
    CLLocationCoordinate2D coordinate;
    
    coordinate.latitude = 30.183031 + (rand()%10)/10000.0;
    
    coordinate.longitude = 120.1722623 + (rand()%10)/10000.0;
    
    CLLocation *newLocation = [[CLLocation alloc]initWithLatitude:coordinate.latitude longitude:coordinate.longitude];
    
    [self setValue:newLocation forKey:@"locationUser"]; //Use kvc set new value
    
    UIAlertView *testAlert = [[UIAlertView alloc] initWithTitle:@"Haha~" message:@"打卡成功啰" delegate:self
    
    cancelButtonTitle:@"OK" otherButtonTitles:nil];
    
    [testAlert show];
    
    }
    
    CHSuper(1, AttendanceViewController, checkButton, button);
    
    }
    
    __attribute__((constructor)) static void entry()
    
    {
    
    CHLoadLateClass(AttendanceViewController);
    
    CHClassHook(1, AttendanceViewController, checkButton);
    
    }
    

    相关文章

      网友评论

          本文标题:Hook-移动办公

          本文链接:https://www.haomeiwen.com/subject/vhvtjttx.html