Android逆向题解2-bobbydylan

  • 运行界面
    在这里插入图片描述
  • 代码分析:
    调用check方法,传入参数是获取用户是输入,抛出异常就“错误”
public void onClick(View arg5) {
        DialogInterface$OnClickListener v3 = null;
        try {
            this.b.check(this.a.getText().toString());
            new AlertDialog$Builder(this.b).setMessage("正确").setNeutralButton("OK", null).create().show();
        }
        catch(Exception v0) {
            new AlertDialog$Builder(this.b).setMessage("错误").setNeutralButton("OK", v3).create().show();
        }
    }

check方法实现加密逻辑

public void check(String arg10) {
        String v0_1;
        int v7 = 15;
        int v6 = 7;
        int v1 = 0;
        int v5 = 5;
        if(arg10.length() != 16) {  //长度不等于16抛出异常,说明key的长度等于16
            throw new RuntimeException();
        }
 
        try {
            v0_1 = this.getKey(); // "bobdylan"
        }
        catch(Exception v0) {
            v0_1 = this.getKey();
            System.arraycopy(v0_1, 0, arg10, v5, v5);
        }
 
        int[] v2 = new int[16];    //创建一个16位的数组与我们要的key的长度一致
        v2[0] = 0;                 //v2[0] = 0
        v2[12] = 14;               //v2[12] = 14
        v2[10] = v6;               //v2[10] = 7
        v2[14] = v7;               //v2[14] = 15
        v2[v7] = 42;               //v2[15] = 42
        int v4 = 3;
        try {
            v2[1] = v4;           //v2[1] = 3
            v2[5] = 5;            //v2[5] = 5
            System.out.println();
        }
        catch(Exception v3) {
            v2[v5] = 37;
            v2[1] = 85;
        }
 
        v2[6] = v7;              //v2[6] = 15
        v2[2] = 13;              //v2[2] = 13
        v2[3] = 19;              //v2[3] = 19
        v2[11] = 68;             //v2[11] = 68
        v2[4] = 85;              //v2[4] = 85
        v2[13] = v5;             //v2[13] = 5
        v2[9] = v6;              //v2[9] = 7
        v2[v6] = 78;             //v2[7] = 78
        v2[8] = 22;              //v2[8] = 22
                                 //得到v2[]={0,3,13,19,85,5,15,78,22,7,7,68,14,5,15,42};
        while(v1 < arg10.length()) {
            if((v2[v1] & 0xFF) != ((arg10.charAt(v1) ^ v0_1.charAt(v1 % v0_1.length())) & 0xFF)) {  //用key的值与"bobdylan"进行异或然后和v2进行比较,那么用v2和"bobdylan"异或就能得到key了
                throw new RuntimeException();
            }
 
            ++v1;
        }
    }
  • 解题思路
    编写解密代码得到 key
public static void main(String[] args) {
        int v2[]={0,3,13,19,85,5,15,78,22,7,7,68,14,5,15,42};
        String b="bobdylan";
        int v1=0;
        while(v1 < 16) {
            System.out.print((char) ((v2[v1] & 0xFF) ^ (b.charAt(v1 % 8) & 0xFF)));
 
            ++v1;
        }
    }

运行结果:blow,in the winD

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值