iOS打包教程

2023-04-18  本文已影响0人  一直在路上66

iOS逆向知识掌握

越狱手机

应用脱壳

工具之IDA

越狱开发工具之Theos

Theos安装

brew install ldid
$ brew install xz
$ sudo cpan IO::Compress::Lzm
export THEOS=/opt/theos
export PATH=$PATH:$THEOS/bin
sudo git clone --recursive https://github.com/theos/theos.git $THEOS
sudo chown -R $(id -u):$(id -g) $THEOS

工具之monkeydev

brew install https://raw.githubusercontent.com/kadwanev/bigboybrew/
master/Library/Formula/sshpass.r
sudo xcode-select -s /Applications/Xcode9.
*新建项目选择Monkeyapp image.png

开始集成SDK

将sdk拖入到工程中

image.png image.png

添加依赖库

image.png

支付宝添加回调

#pragma mark - 支付回调,必接

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
    [WCmsSDK application:application handleOpenURL:url];
    return %orig;
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options {
    [WCmsSDK application:application openURL:url options:options];
    return  %orig;
}

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
    [WCmsSDK application:application openURL:url sourceApplication:sourceApplication annotation:annotation];
    return %orig;
}

wansdk初始化代码

%hook AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // sdk初始化
    [WCmsSDK didFinishLaunching];
    return %orig;
}

接入登录

%hook   BRSDKApi

- (void)login{
    %log;
//    %orig;
    [self wanlogin];
}
%new
- (void)wanlogin{
    [WCmsSDK loadLoginViewResultSuccess:^(NSString *logintime, NSString *userName, NSString *sign, NSString *rzStatus) {
        NSLog(@"WCmsSDK____%@%@%@%@",logintime,userName,sign,rzStatus);
        NSString* openId = [NSString stringWithFormat:@"%@_%@", @"brsyp", userName];
        dispatch_async(dispatch_get_main_queue(), ^{
            [BoRanSDK thirdLoginWithOpenId:openId];
        });
    } failed:^(NSInteger code, NSString *message) {

    }];
}

%end

接入支付

-(void)pay_param:(NSDictionary *)param{
        %log;
        %orig;
    [BoRanSDK tradeOrderNum:param];
//    [self wanPay:param];
}
+(void)tradeOrderNum:(NSDictionary*)param{
    
    BRSDKOrderInfo* orderInfo = [[BRSDKOrderInfo alloc] init];
    orderInfo.productId = param[@"product_id"];
    orderInfo.productName = param[@"product_name"];
    orderInfo.productDesc = param[@"product_name"];
    NSString *amount =  param[@"amount"];
    orderInfo.productPrice = [NSString stringWithFormat:@"%ld",amount.integerValue*100];
    orderInfo.roleId = param[@"role_id"];
    orderInfo.roleName = param[@"role_name"];
    orderInfo.serverId = param[@"server_id"];
    orderInfo.serverName = param[@"server_name"];
    orderInfo.extInfo = param[@"extend"];
    NSMutableDictionary *resDict = [[NSMutableDictionary alloc]init];
    resDict[@"productId"] = orderInfo.productId;
    resDict[@"product"] = orderInfo.productName;
    resDict[@"orderMoneyFen"] = orderInfo.productPrice;
    resDict[@"roleId"] = orderInfo.roleId;
    resDict[@"roleName"] = orderInfo.roleName;
    resDict[@"serverId"] = orderInfo.serverId;
    resDict[@"serverName"] = orderInfo.serverName;
    resDict[@"extInfo"] = orderInfo.extInfo;
    [YouRequestManager requtForPouWayWithParams:resDict Block:^(NSDictionary *dic) {
        NSLog(@"requtForPouWayWithParams === %@",dic);
    } withFail:^(NSError *error) {
        
    }];
}

上传角色

-(void)upLoadRoleType:(NSString *)type Uid:(NSString *)user_id serverID:(NSString *)server_id serverName:(NSString *)server_name role_ID:(NSString *)role_id roleName:(NSString *)role_name level:(NSString *)level balanceID:(NSString *)balanceid balanceName:(NSString *)balancename balanceNum:(NSString *)balancenum vip:(NSString *)vip power:(NSString *)power gender:(NSString *)gender professionid:(NSString *)professionid profession:(NSString *)profession turn_level:(NSString *)turn_level partyId:(NSString *)partyid partyName:(NSString *)partyname{
    %orig;
    [WCmsSDK SetUserInfoDataWithRoleId:role_id
                              roleName:role_name
                             roleLevel:level
                                zoneId:server_id
                              zoneName:server_name
                                attach:@"无"
                                 block:^(NSInteger code) {
                                     if (code == 1) {
//                                         [YGMessage showMessage:@"上传成功"];
                                         NSLog(@"角色上传成功");
                                     };
                                 }];
    
    GameRoleInfo *roleInfo =  [[GameRoleInfo alloc]init];
    roleInfo.uploadType = UploadRoleInfoTypeCreateRole;
    roleInfo.serverId = server_id;
    roleInfo.serverName = server_name;
    roleInfo.roleId = role_id;
    roleInfo.roleName = role_name;
    roleInfo.roleLevel = level;
    roleInfo.partyName = @"无";
    roleInfo.roleCTime = [self gs_getCurrentTimeBySecond];
    roleInfo.balance = 20.0;
    roleInfo.fightingCapacity = @"10";
    roleInfo.reincarnation = @"0";
    roleInfo.roleVip = @"0";
    [BoRanSDK  sendGameRoleInfo:roleInfo];
}

#pragma mark - 角色上报

+ (void)sendGameRoleInfo:(GameRoleInfo *)roleInfo
{
    NSMutableDictionary* infoDict = [NSMutableDictionary dictionary];
    [infoDict setValue:@(roleInfo.uploadType) forKey:@"uploadType"];
    [infoDict setValue:roleInfo.serverId forKey:@"serverId"];
    [infoDict setValue:roleInfo.serverName forKey:@"serverName"];
    [infoDict setValue:roleInfo.roleId forKey:@"roleId"];
    [infoDict setValue:roleInfo.roleName forKey:@"roleName"];
    [infoDict setValue:roleInfo.roleLevel forKey:@"roleLevel"];
    [infoDict setValue:roleInfo.roleVip forKey:@"roleVip"];
    [infoDict setValue:@(roleInfo.balance) forKey:@"balance"];
    [infoDict setValue:roleInfo.partyName forKey:@"partyName"];
    [infoDict setValue:roleInfo.fightingCapacity forKey:@"fightingCapacity"];
    [infoDict setValue:roleInfo.reincarnation forKey:@"reincarnation"];
    [infoDict setValue:@(roleInfo.roleCTime) forKey:@"roleCTime"];
    
    //1.上报渠道角色信息
#if HAS_INCLUDE_CHANNEL
    if ([[sdkTools shareTool].loginMode intValue] != (int)LOGIN_MODE_BORAN) {
        
        int nType = 1;
        switch (roleInfo.uploadType) {
            case UploadRoleInfoTypeEnterGame:
                nType = 1;
                break;
            case UploadRoleInfoTypeCreateRole:
                nType = 2;
                break;
            case UploadRoleInfoTypeRoleLevelUp:
                nType = 3;
                break;
            case UploadRoleInfoTypeExitGame:
                nType = 4;
                break;
            default:
                break;
        }
        
        [infoDict setValue:@(nType) forKey:@"dataType"];
        [infoDict setValue:roleInfo.roleVip forKey:@"roleVipLevel"];
        [infoDict setValue:@(roleInfo.balance) forKey:@"roleBalence"];
        [infoDict setValue:@(roleInfo.roleCTime) forKey:@"rolelevelCtime"];
        [[BoranChannel sharedInstance] SendRoleInfo:infoDict];
    }
#endif
    
    //2.上报官方角色信息
    [YouRequestManager sendFforRole:infoDict WithBlock:^(NSDictionary *dic) {
        
        NSLog(@"send roleInfoDict = %@", infoDict);
        
        NSString *stuats = [[dic objectForKey:@"status"]stringValue];
        if ([stuats isEqualToString:@"1"]) {
            NSDictionary *succ = [[NSDictionary alloc]initWithObjectsAndKeys:@"401",@"code", nil];
            [[NSNotificationCenter defaultCenter]postNotificationName:kBRSDKSendRoleNotification object:nil userInfo:succ];
        }else{
            NSDictionary *succ = [[NSDictionary alloc]initWithObjectsAndKeys:@"402",@"code", nil];
            [[NSNotificationCenter defaultCenter]postNotificationName:kBRSDKSendRoleNotification object:nil userInfo:succ];
        }
    } withFail:^(NSError *error) {
        NSDictionary *succ = [[NSDictionary alloc]initWithObjectsAndKeys:@"403",@"code", nil];
        [[NSNotificationCenter defaultCenter]postNotificationName:kBRSDKSendRoleNotification object:nil userInfo:succ];
    }];
}
上一篇下一篇

猜你喜欢

热点阅读