[Ingénierie inverse et sécurité iOS] Le développement de plug-ins pour une certaine salle de diffusion en direct d'application musicale envoie automatiquement 666

1. Objectif

Parce que lorsque je regardais l'émission en direct, le présentateur m'a demandé d'envoyer 666 pour le soutenir. Je l'ai définitivement soutenu, alors j'ai continué à l'envoyer. Mais plus tard, j'ai découvert que c'était une perte de temps. Puis-je créer une salle de diffusion en direct envoyer automatiquement 666 ? J'ai donc passé quelques minutes à en faire un.

2. Environnement opérationnel
  • Jailbreaker un iPhone

  • frida

  • Mac

 3. Processus

Téléchargez la dernière application Yin

Puisque nous envoyons des messages, le mot-clé sendmessage est notre point d’entrée.

Exécuter dans le terminal
//模糊匹配sendmessage
frida-trace -U  -m "*[* *messag*]" xxxxx音   

Après avoir exécuté la commande, la liste d'informations est obtenue :

Après avoir examiné et imprimé les paramètres d'entrée et les valeurs de retour des méthodes ci-dessus, les paramètres du journal de sortie ont attiré notre attention.

Informations clés : envoyerComment
-[HTSLiveCommentFragment sendComment:0x9e4d4021463d8688 source:0x0 messageSource:0x0 completion:0x0]

Vérifiez notre conjecture

Exécuter dans le terminal et continuer à s'accrocher

frida-trace -UF  -m "-[HTSLiveCommentFragment sendComment:source:messageSource:completion:]"

Obtenez la liste d'informations:

 -[HTSLiveCommentFragment sendComment:666666666 source:0x0 messageSource:0x0 completion:0x0]

Parmi eux, "6666666" est le contenu que j'ai envoyé dans la salle de diffusion en direct.

Ensuite, le problème survient, j'ai trouvé que la méthode d'envoi est le signe moins - [xxxx xxxxxx]

De cette façon, HTSLiveCommentFragment ne peut pas être appelé directement.

Continuez ensuite à accrocher HTSLiveCommentFragment et voyez où il a été créé.

Exécuter dans le terminal et continuer à s'accrocher
frida-trace -UF -m "-[HTSLiveCommentFragment *]"

Obtenez la liste d'informations: 

  3964 ms  -[HTSLiveCommentFragment initWithStore:0x2836ef200]
  3964 ms  -[HTSLiveCommentFragment initWithStore:<HTSLiveCommentStore: 0x2836ef200>]

 J'ai constaté que HTSLiveCommentFragment est créé par initWithStore.

Créez ensuite le hook directement et appelez sendComment pour envoyer le message.

3. Écrivez les journaux du plug-in Deb

NSString *nickname=@"未获取昵称";

HTSLiveCommentFragment *liveComm;//全局 储存创建好的对象 类

%hook HTSLiveCommentFragment
//HTSLiveCommentStore
- (HTSLiveCommentFragment *)initWithStore:(id)arg1{
    
//    id mHTSLiveUser = MSHookIvar<id>(arg1,"_currentUse");//HTSLiveUser
//    NSString *name = MSHookIvar<NSString *>(mHTSLiveUser,"nickname");
//    nickname =name;
    
    liveComm = %orig;//获取到创建好的对象 类(每切换一次,自动覆盖

    return liveComm;
}

%end
 Obtenez la page de diffusion en direct

HTSLiveAudienceViewController, ajoutez-y un bouton

 Ajouter un petit bouton rond à la page
BallUIView *upASUserInfo;//移动圆圆

//直播页面 Controller
%hook HTSLiveAudienceViewController

- (void)viewDidLoad{
    %orig;// 页面加载完毕
    
    __weak typeof(self) weakSelf = self;
    if(upASUserInfo == nil){
        //配置
        CGRect rect_screen = [[UIScreen mainScreen]bounds];
        CGSize size_screen = rect_screen.size;
        int height = size_screen.height;
        int width  = size_screen.width;
        
        // 移动圆圆
        upASUserInfo = [[BallUIView alloc] initWithFrame:CGRectMake(width-80, height/2-200, 50, 50)];
        upASUserInfo.backgroundColor = [UIColor whiteColor];
        upASUserInfo.layer.cornerRadius = 25;
        upASUserInfo.layer.masksToBounds = YES;
        
        //小圆球 图标
        UIImageView *imgViewM = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"[email protected]"]];
        imgViewM.autoresizingMask = UIViewAutoresizingFlexibleWidth;
        imgViewM.frame = CGRectMake(0, 0, 50, 50);
        [upASUserInfo insertSubview:imgViewM atIndex:0];
        
        
        
    }
    
    [weakSelf.view addSubview:upASUserInfo];
    
    upASUserInfo.btnClick = ^(UIButton *sender) {
        UIAlertController *ac = [UIAlertController alertControllerWithTitle:@"当前标识"
                                                                    message:nickname
                                                             preferredStyle:UIAlertControllerStyleAlert];
        UIAlertAction *ala1 = [UIAlertAction actionWithTitle:@"666666" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action){

        }];
        UIAlertAction *ala2 = [UIAlertAction actionWithTitle:@"发送消息" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action){
            [xddCode userInfoModel:liveComm];//传入获取到的 对象,发送消息
        }];
        UIAlertAction *ala3 = [UIAlertAction actionWithTitle:@"退出应用" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action){
            exit(0);
        }];
        UIAlertAction *Cancel = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
            
        }];
        
        [ac addAction:ala1];
        [ac addAction:ala2];
        [ac addAction:ala3];
        [ac addAction:Cancel];
        
        [weakSelf presentViewController:ac animated:YES completion:nil];
    };
    
    
    
}
%end

 

xddCode.m

#import "xddCode.h"

@implementation xddCode

+(NSString *) userInfoModel:(HTSLiveCommentFragment*)info {

    [info sendComment:@"666666666" source:0x0 messageSource:0x0 completion:0x0];
}

@end

Code source de Xiaoyuanqiu

BallUIView.h


#import <UIKit/UIKit.h>

typedef void (^floatBtnClick)(UIButton *sender);

NS_ASSUME_NONNULL_BEGIN

@interface BallUIView : UIView
// 属性 机,记录起点

@property(nonatomic,assign)CGPoint startPoint;


//按钮点击事件
@property (nonatomic, copy)floatBtnClick btnClick;

@end

NS_ASSUME_NONNULL_END

BallUIView.m



#import "BallUIView.h"


#define screenW  [UIScreen mainScreen].bounds.size.width
#define screenH  [UIScreen mainScreen].bounds.size.height

@interface BallUIView()
//悬浮的按钮
//@property (nonatomic, strong) MNFloatContentBtn *floatBtn;
@end

@implementation BallUIView{
    
    //拖动按钮的起始坐标点
    CGPoint _touchPoint;
    
    //起始按钮的x,y值
    CGFloat _touchBtnX;
    CGFloat _touchBtnY;
}

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
//    NSLog(@"按下 获取起点1");
    
    //获取 触摸 对象
    
    UITouch *touch = [touches anyObject];
    
    _touchBtnX = self.frame.origin.x;
    _touchBtnY = self.frame.origin.y;
    
    //找到点击的起点
    self.startPoint = [touch locationInView:self];
    
}

-(void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
//    NSLog(@"移动  让小球的运动起来2");
    
    //先回去  触摸对象
    
    UITouch * touch = [touches anyObject];

    //获取移动中的点
    CGPoint newPoint = [touch locationInView:self];
    
    //计算x y 坐标分别移动了多少
    CGFloat dx = newPoint.x - self.startPoint.x;
    CGFloat dy = newPoint.y - self.startPoint.y;
    
    //改变小球的位置
    self.center = CGPointMake(self.center.x + dx,
                                      self.center.y + dy);
    

}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
//    NSLog(@"按下 结束3");
    
    CGFloat btnY = self.frame.origin.y;
    CGFloat btnX = self.frame.origin.x;
    CGFloat minDistance = 3;
    
    //结束move的时候,计算移动的距离是>最低要求,如果没有,就调用按钮点击事件
    BOOL isOverX = fabs(btnX - _touchBtnX) > minDistance;
    BOOL isOverY = fabs(btnY - _touchBtnY) > minDistance;
    
    if (isOverX || isOverY) {
        //超过移动范围就不响应点击 - 只做移动操作
        //NSLog(@"move - btn");
        //设置移动方法
        [self setMovingDirectionWithBtnX:btnX btnY:btnY];
    }else{
        //NSLog(@"call - btn");
        if (self.btnClick) {
            self.btnClick(nil);
        }else{
            //[self changeEnv];
        }
    }
    
    
}

static CGFloat floatBtnW = 50;
static CGFloat floatBtnH = 50;
- (void)setMovingDirectionWithBtnX:(CGFloat)btnX btnY:(CGFloat)btnY{
//    switch (_type) {
//        case MNAssistiveTypeNone:{
            //自动识别贴边
            if (self.center.x >= screenW/2) {

                [UIView animateWithDuration:0.5 animations:^{
                    //按钮靠右自动吸边
                    CGFloat btnX = screenW - floatBtnW;
                    self.frame = CGRectMake(btnX, btnY, floatBtnW, floatBtnH);
                }];
            }else{

                [UIView animateWithDuration:0.5 animations:^{
                    //按钮靠左吸边
                    CGFloat btnX = 0;
                    self.frame = CGRectMake(btnX, btnY, floatBtnW, floatBtnH);
                }];
            }
//            break;
//        }
//        case MNAssistiveTypeNearLeft:{
//            [UIView animateWithDuration:0.5 animations:^{
//                //按钮靠左吸边
//                CGFloat btnX = 0;
//                self.frame = CGRectMake(btnX, btnY, floatBtnW, floatBtnH);
//            }];
//            break;
//        }
//        case MNAssistiveTypeNearRight:{
//            [UIView animateWithDuration:0.5 animations:^{
//                //按钮靠右自动吸边
//                CGFloat btnX = screenW - floatBtnW;
//                self.frame = CGRectMake(btnX, btnY, floatBtnW, floatBtnH);
//            }];
//        }
//    }
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
  enfin

Vous pouvez vous amuser et l’hôte ne dira plus jamais que je ne le soutiens plus.

Je suppose que tu aimes

Origine blog.csdn.net/qq_21051503/article/details/133138838
conseillé
Classement