首页
社区
课程
招聘
[原创]一个crackme的注册算法
2012-9-13 22:08 9217

[原创]一个crackme的注册算法

2012-9-13 22:08
9217
今天瞎逛的时候,偶然发现一个crackme,于是拿来练手。
拿到样本先安装看看
如图:

看图上是用户名和序列号的注册方式。
那我们反编译apk看看代码。
在代码中如下代码:
public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903040);
    TelephonyManager localTelephonyManager = (TelephonyManager)getSystemService("phone");
    String str1 = localTelephonyManager.getDeviceId();
    new TextView(this);
    ((TextView)findViewById(2131034112)).setText("HardwareID 01: " + str1);
    String str2 = localTelephonyManager.getSimSerialNumber();
    new TextView(this);
    ((TextView)findViewById(2131034113)).setText("HardwareID 02: " + str2);
说明我们看到的ID1和ID2分别是由机器的IMEI和sim卡生成。
那我们在找找是如何生成注册码的呢?
在图中我们看到只有来两个按钮,一个注册按钮(这个按钮需要我们多加留意),一个是关于(这个按钮我们无需关注)。
按照这个思路,我们可以在反编译的代码中看到:
private View.OnClickListener pulsarBoton = new View.OnClickListener()
  {
    public void onClick(View paramView)
    {
      String str1 = ((EditText)HelloAndroid.this.findViewById(2131034116)).getText().toString();
      int i = str1.length();
      String str2 = "";
      String str3 = ((EditText)HelloAndroid.this.findViewById(2131034118)).getText().toString();
      if (i < 4);
      while (true)
      {
        try
        {
          Toast.makeText(HelloAndroid.this.getApplicationContext(), "Min 4 chars", 1).show();
          break label307;
          int k = str1.length();
          if (j >= k)
          {
            String str4 = String.valueOf(0x6B016 ^ Integer.parseInt(str2.substring(0, 5)));
            TelephonyManager localTelephonyManager = (TelephonyManager)HelloAndroid.this.getSystemService("phone");
            String str5 = localTelephonyManager.getDeviceId();
            String str6 = localTelephonyManager.getSimSerialNumber();
            String str7 = str5.substring(0, 6);
            String str8 = str6.substring(0, 6);
            long l = Integer.parseInt(str7) ^ Integer.parseInt(str8);
            if (!(str4 + "-" + String.valueOf(l) + "-" + str7).equals(str3))
              break label291;
            Toast.makeText(HelloAndroid.this.getApplicationContext(), "God boy", 1).show();
          }
        }
        catch (Exception localException)
        {
          Toast.makeText(HelloAndroid.this.getApplicationContext(), "Another Error Ocurred :(", 1).show();
        }
        int m = str1.charAt(j);
        str2 = str2 + m;
        j++;
        continue;
        label291: Toast.makeText(HelloAndroid.this.getApplicationContext(), "Bad boy ", 1).show();
        label307: return;
        int j = 0;
      }
如果注册码正确则toast "God boy",如果错误则"Bad boy "。
首先我们的注册名必须满足4位。
从代码中我们可以看出注册码构成则是xxxx-xxxx-xxxx。
首先看第一位:第一位的构成是由用户名字符的ASCII取5位^0x6B016,如用户名为crack,即注册码为471868
第二位则是IMEI号的前6位^sim卡号的前6位,即注册码第二位为000000^890141 = 890141。
第三位的注册码构成是IMEI号的前6位 000000.
那我们注册的用户名crack
注册码为471868-890141-000000.
写的比较简单,呵呵。
最后附上apk。
Crackme03.apk

[培训]《安卓高级研修班(网课)》月薪三万计划,掌 握调试、分析还原ollvm、vmp的方法,定制art虚拟机自动化脱壳的方法

上传的附件:
收藏
点赞3
打赏
分享
最新回复 (4)
雪    币: 139
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
seuer 2012-9-15 16:12
2
0
强大啊,apk程序也能被反编译啊
雪    币: 19
活跃值: (102)
能力值: ( LV12,RANK:200 )
在线值:
发帖
回帖
粉丝
不死神鸟 1 2012-9-16 02:53
3
0
安卓的!!!!!!!!!!
雪    币: 99
活跃值: (17)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
八神许愿 2012-9-25 10:57
4
0
这种类型一般爆破比较方便
雪    币: 247
活跃值: (42)
能力值: ( LV3,RANK:30 )
在线值:
发帖
回帖
粉丝
arsusanh 2012-11-4 12:21
5
0
if (!(str4 + "-" + String.valueOf(l) + "-" + str7).equals(str3))
              break label291;
            Toast.makeText(HelloAndroid.this.getApplicationContext(), "God boy", 1).show();

去掉了!号  怎么不能重建  dex
游客
登录 | 注册 方可回帖
返回