首页
社区
课程
招聘
[求助]请大牛看看这个CM的算法
发表于: 2012-7-20 19:03 6879

[求助]请大牛看看这个CM的算法

2012-7-20 19:03
6879
public class GoAheadCrackMe extends Activity
{
  private int[] key;

  public GoAheadCrackMe()
  {
    int[] arrayOfInt = { 32, 82, 33, 2, 248 };
    this.key = arrayOfInt;
  }

  private boolean itsRight(String paramString)
  {
    int i = 0;
    InputStream localInputStream;
    try
    {
      String str1 = getResources().getString(2131034119);
      localInputStream = getResources().getAssets().open(str1);
      int j = 0;
      int k = localInputStream.read();
      int m;
      if (k >= 0)
      {
        m = paramString.length();
        int n = m;
        if (j >= n)
          if (localInputStream == null);
      }
      while (true)
      {
        try
        {
          localInputStream.close();
          return i;
        }
        catch (IOException localIOException1)
        {
          StringBuilder localStringBuilder1 = new StringBuilder().append("IOException: ");
          String str2 = localIOException1.toString();
          String str3 = str2;
          int i1 = Log.e("GoAheadCrackMe", str3);
          continue;
        }
        int[] arrayOfInt = this.key;
        int i2 = this.key.length;
        int i3 = j % i2;
        int i4 = (char)(arrayOfInt[i3] ^ k);
        m = paramString.charAt(j);
        int i5 = m;
        if (i4 != i5)
        {
          if (localInputStream == null)
            continue;
          try
          {
            localInputStream.close();
          }
          catch (IOException localIOException2)
          {
            StringBuilder localStringBuilder2 = new StringBuilder().append("IOException: ");
            String str4 = localIOException2.toString();
            String str5 = str4;
            int i6 = Log.e("GoAheadCrackMe", str5);
          }
          continue;
        }
        j += 1;
        m = localInputStream.read();
        k = m;
        break;
        i = 1;
        if (localInputStream == null)
          continue;
        try
        {
          localInputStream.close();
        }
        catch (IOException localIOException3)
        {
          StringBuilder localStringBuilder3 = new StringBuilder().append("IOException: ");
          String str6 = localIOException3.toString();
          String str7 = str6;
          int i7 = Log.e("GoAheadCrackMe", str7);
        }
      }
    }
    catch (IOException localIOException4)
    {
      while (true)
      {
        StringBuilder localStringBuilder4 = new StringBuilder().append("IOException: ");
        String str8 = localIOException4.toString();
        String str9 = str8;
        int i8 = Log.e("GoAheadCrackMe", str9);
        if (localInputStream == null)
          continue;
        try
        {
          localInputStream.close();
        }
        catch (IOException localIOException5)
        {
          StringBuilder localStringBuilder5 = new StringBuilder().append("IOException: ");
          String str10 = localIOException5.toString();
          String str11 = str10;
          int i9 = Log.e("GoAheadCrackMe", str11);
        }
      }
    }
    finally
    {
      if (localInputStream == null);
    }
    try
    {
      localInputStream.close();
      throw localObject;
    }
    catch (IOException localIOException6)
    {
      while (true)
      {
        StringBuilder localStringBuilder6 = new StringBuilder().append("IOException: ");
        String str12 = localIOException6.toString();
        String str13 = str12;
        int i10 = Log.e("GoAheadCrackMe", str13);
      }
    }
  }


初始化部分

定义一个int数组{0x20,0x52,0x21,0x2,0xf8}

boink.data的内容:
543a 4871 d857 3352 228c 4f3d 0167 9953
2b00

算法部分:

取int数组长度
取模运算
然后比较

我运算的出来的有些明显的不是字符,这样要怎么处理呢,这个的正真算法又是什么呢,
希望大牛分析下

[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)

上传的附件:
收藏
免费 0
支持
分享
最新回复 (4)
雪    币: 317
活跃值: (72)
能力值: ( LV5,RANK:60 )
在线值:
发帖
回帖
粉丝
2
当转换后的java代码让人无法分析的时候,可以仔细看看smali文件来分析算法。

这个算法其实非常简单,就是将
543a 4871 d857 3352 228c 4f3d 0167 9953 2b00
依次与{0x20,0x52,0x21,0x2,0xf8}进行异或运算,答案就是
this was too easy!


从其算法来看,它只检查开头的18个字符,所以只要是以
this was too easy!

开头的字符串都可以通过验证!
2012-7-26 19:40
0
雪    币: 1024
活跃值: (240)
能力值: ( LV12,RANK:310 )
在线值:
发帖
回帖
粉丝
3
lz对android造诣很深啊
2012-7-26 20:04
0
雪    币: 317
活跃值: (72)
能力值: ( LV5,RANK:60 )
在线值:
发帖
回帖
粉丝
4
楼上的兄弟过奖了!
2012-7-27 09:05
0
雪    币: 204
活跃值: (25)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
5
感谢大牛解答
我开始以为 localInputStream.read() 是依次读取boink.data中字符的ASCⅡ码然后异或

这下知道了,以后还是要多结合smali的来分析
2012-7-27 11:05
0
游客
登录 | 注册 方可回帖
返回
//