UC-Android逆向工程师 面试题1的分析
阅读原文时间:2023年07月10日阅读:4

这个题目是一位吾爱破解的坛友在面试UC的Android逆向工程事时,遇到的题目。此题不难,与阿里移动去年移动安全比赛的题目差不多,题目的验证方式也是查表对比,并且这个表的数据是放在文件中的。

直接使用JEB对UC-crackme.apk程序进行反编译,得到下面的结果:

获取查询的密码表,即文件abcdefghddddd的文件偏移0x15D81开始到0x16081结束的0x300字节的数据。

获取中间参与最终字符串比较的18字节的数据即文件abcdefghddddd的文件偏移0x16481开始的后面18个字节的数据。

通过用户输入的注册码,查询密码表获取参与比较的密码字符串。

经过前面的分析,写了个注册机,代码如下:

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

/**
 *
 */

/**
 * @author Fly2014
 *
 */
public class Key
{
    /**
     * @param args
     * @throws IOException
     */
    public static void main(String[] args) throws IOException
    {
        // 创建文件类
        File file = new File("abcdefghddddd");

        // 构造文件输入流
        FileInputStream fileInputStream = new FileInputStream(file);

        // 获取文件的大小
        int nFileSize = fileInputStream.available();

        // 申请内存空间
        byte[] byteArryFile = new byte[nFileSize];

        byte[] byteArryTable = new byte[768];

        byte[] byteArryResult = new byte[18];

        // 读取文件的数据到内存中
        fileInputStream.read(byteArryFile, 0, nFileSize);

        // 获取密码查询表0x300字节
        System.arraycopy(byteArryFile, 0x15D81, byteArryTable, 0, 768);

        // 获取最终参与比较的18字节的密码
        System.arraycopy(byteArryFile, 0x16481, byteArryResult, 0, 18);

        // 密码查询表转utf-8格式
        String strTable = new String(byteArryTable, "utf-8");

        // 18字节密码装utf-8格式
        String strResult = new String(byteArryResult, "utf-8");

        // 存放用户输入的注册码
        StringBuilder strBuilderKey = new StringBuilder();

        // 包里查询破解
        for (int i = 0; i < 6; i++)
        {
            for (int j = 0; j < 255; j++)
            {
                if (strTable.charAt(j) == strResult.charAt(i))
                {
                    // 获取用户输入的字符
                    strBuilderKey.append((char) j);

                    break;
                }
            }
        }

        // 输出key
        System.out.println("输入的注册码:" + strBuilderKey.toString() + "\n");

        // 参与比较的最终密码
        System.out.println("比较的中间密码:" + strResult.toString() + "\n");

        System.out.println("显示查询密码表:");

        for (int a = 0; a < 255; a++)
        {
            System.out.print(strTable.charAt(a));

            if ((a + 1) % 51 == 0 && a != 0)
            {
                System.out.print("\n");
            }
        }

    }
}

经过分析发现,最终的输入字符串是581026。

分析文档的下载地址:http://download.csdn.net/detail/qq1084283172/9029777

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器