灯火互联
管理员
管理员
  • 注册日期2011-07-27
  • 发帖数41778
  • QQ
  • 火币41290枚
  • 粉丝1086
  • 关注100
  • 终身成就奖
  • 最爱沙发
  • 忠实会员
  • 灌水天才奖
  • 贴图大师奖
  • 原创先锋奖
  • 特殊贡献奖
  • 宣传大使奖
  • 优秀斑竹奖
  • 社区明星
阅读:2458回复:0

一个crackme的注册算法

楼主#
更多 发布于:2012-09-25 14:27

今天瞎逛的时候,偶然发现一个crackme,于是拿来练手。

拿到样本先安装看看

如图:

图片:20120925113815107.jpg

 

看图上是用户名和序列号的注册方式。

那我们反编译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 = ""; www.atcpu.com

      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.

写的比较简单,呵呵。


喜欢0 评分0
游客

返回顶部