ArmedImmediatel 发表于 2025-1-24 15:50:02

求帮写注册机

本帖最后由 ArmedImmediatel 于 2025-1-24 15:56 编辑

今天看到一个有秘钥验证的apk 本来想着练练手写个注册机 结果绕着绕着绕晕了 有哪位大佬能看懂
反编译伪java代码:
package formatFa.comic;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;

public class FAppProtect extends Activity {
    EditText edit;
    Button enter;
    int id = -1;
    int key = 520;
    String temp;
    TextView tv;

    public FAppProtect() {
    }

    public static String byte2hex(byte[] bArr) {
      byte[] bArr2 = bArr;
      String str = "";
      String str2 = "";
      for (byte b : bArr2) {//依次抽出bArr2数组每个项遍历
            str2 = Integer.toHexString(b & 255);
            StringBuffer stringBuffer;
            StringBuffer stringBuffer2;
            if (str2.length() == 1) {
                stringBuffer = r8;
                stringBuffer2 = new StringBuffer();
                stringBuffer2 = r8;
                StringBuffer stringBuffer3 = new StringBuffer();
                str = stringBuffer.append(stringBuffer2.append(str).append("0").toString()).append(str2).toString();
            } else {
                stringBuffer = r8;
                stringBuffer2 = new StringBuffer();
                str = stringBuffer.append(str).append(str2).toString();
            }
      }
      return str.toUpperCase();
    }

    public static String de(String str) {
      String str2 = str;
      if (str2 == null) {
            return (String) null;
      }
      String str3 = "vice587@.613฿@95";
      if (str3 == null) {
            try {
                return (String) null;
            } catch (Exception e) {
                System.out.println(e.toString());
                return (String) null;
            }
      } else if (str3.length() != 16) {
            return (String) null;
      } else {
            SecretKeySpec secretKeySpec = r13;
            SecretKeySpec secretKeySpec2 = new SecretKeySpec(str3.getBytes("ASCII"), "AES");
            SecretKeySpec secretKeySpec3 = secretKeySpec;
            Cipher instance = Cipher.getInstance("AES");
            instance.init(2, secretKeySpec3);
            try {
                String str4 = r13;
                String str5 = new String(instance.doFinal(hex2byte(str2)));
                return str4;
            } catch (Exception e2) {
                System.out.println(e2.toString());
                return (String) null;
            }
      }
    }

    public static String en(String str) throws Exception {
      String str2 = str;
      String str3 = "vice587@.613฿@95";
      if (str3 == null) {
            return (String) null;
      }
      if (str3.length() != 16) {
            return (String) null;
      }
      SecretKeySpec secretKeySpec = r11;
      SecretKeySpec secretKeySpec2 = new SecretKeySpec(str3.getBytes("ASCII"), "AES");
      SecretKeySpec secretKeySpec3 = secretKeySpec;
      Cipher instance = Cipher.getInstance("AES");
      instance.init(1, secretKeySpec3);
      return byte2hex(instance.doFinal(str2.getBytes())).toLowerCase();
    }

    public static String formatDuring(long j) {
      long j2 = j;
      long j3 = j2 / ((long) 86400000);
      long j4 = (j2 % ((long) 86400000)) / ((long) 3600000);
      long j5 = (j2 % ((long) 3600000)) / ((long) 60000);
      long j6 = (j2 % ((long) 60000)) / ((long) 1000);
      StringBuffer stringBuffer = r20;
      StringBuffer stringBuffer2 = new StringBuffer();
      stringBuffer2 = r20;
      StringBuffer stringBuffer3 = new StringBuffer();
      stringBuffer3 = r20;
      StringBuffer stringBuffer4 = new StringBuffer();
      stringBuffer4 = r20;
      StringBuffer stringBuffer5 = new StringBuffer();
      stringBuffer5 = r20;
      StringBuffer stringBuffer6 = new StringBuffer();
      stringBuffer6 = r20;
      StringBuffer stringBuffer7 = new StringBuffer();
      stringBuffer7 = r20;
      StringBuffer stringBuffer8 = new StringBuffer();
      return stringBuffer.append(stringBuffer2.append(stringBuffer3.append(stringBuffer4.append(stringBuffer5.append(stringBuffer6.append(stringBuffer7.append(j3).append(" 天 ").toString()).append(j4).toString()).append(" 小时 ").toString()).append(j5).toString()).append(" 分钟 ").toString()).append(j6).toString()).append(" 秒 ").toString();
    }

    public static byte[] hex2byte(String str) {
      String str2 = str;
      if (str2 == null) {
            return (byte[]) null;
      }
      int length = str2.length();
      if (length % 2 == 1) {
            return (byte[]) null;
      }
      byte[] bArr = new byte[(length / 2)];
      for (int i = 0; i != length / 2; i++) {
            bArr = (byte) Integer.parseInt(str2.substring(i * 2, (i * 2) + 2), 16);
      }
      return bArr;
    }

    void dia(String str, OnClickListener onClickListener) {
      String str2 = str;
      OnClickListener onClickListener2 = onClickListener;
      Builder builder = r8;
      Builder builder2 = new Builder(this);
      Builder builder3 = builder;
      builder = builder3.setTitle("*_*");
      builder = builder3.setMessage(str2);
      builder = builder3.setPositiveButton("确定", onClickListener2);
      AlertDialog show = builder3.show();
    }

    void enter() {
      Intent intent = r5;
      Intent intent2 = intent2;
      try {
            intent2 = new Intent(this, Class.forName("com.iapp.app.run.load"));
            startActivity(intent);
            finish();
      } catch (Throwable e) {
            Throwable th = e;
            NoClassDefFoundError noClassDefFoundError = r11;
            NoClassDefFoundError noClassDefFoundError2 = new NoClassDefFoundError(th.getMessage());
            throw noClassDefFoundError;
      }
    }

    @Override
    public void onCreate(Bundle bundle) {
      Exception exception;
      NumberFormatException numberFormatException;
      this.key = 123456789;
      super.onCreate(bundle);
      SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
      boolean z = defaultSharedPreferences.getBoolean("q1737611219077", false);
      if (defaultSharedPreferences.getBoolean("q1737611220076", false)) {
            enter();
            return;
      }
      boolean commit;
      this.temp = defaultSharedPreferences.getString("sss", "");
      Date date = r24;
      Date date2 = new Date();
      Date date3 = date;
      long j = (long) -1;
      long j2 = (long) -1;
      try {
            j = Long.parseLong(de(this.temp));
      } catch (Exception e) {
            exception = e;
      } catch (NumberFormatException e2) {
            numberFormatException = e2;
      }
      if (z) {
            this.temp = defaultSharedPreferences.getString("ttt", "");
            try {
                j2 = Long.parseLong(de(this.temp));
            } catch (Exception e3) {
                exception = e3;
            } catch (NumberFormatException e22) {
                numberFormatException = e22;
            }
            if (date3.getTime() - j > j2) {
                dia("已过期!", (OnClickListener) null);
                commit = defaultSharedPreferences.edit().putBoolean("q1737611219077", false).commit();
                commit = defaultSharedPreferences.edit().putString("sss", "").commit();
                commit = defaultSharedPreferences.edit().putString("ttt", "").commit();
            } else {
                enter();
                return;
            }
      }
      this.id = defaultSharedPreferences.getInt("id", -1);
      if (this.id == -1) {
            this.id = (int) ((Math.random() * ((double) 1000000000)) % ((double) 100000));
            commit = defaultSharedPreferences.edit().putInt("id", this.id).commit();
      }
      View view = r24;
      View linearLayout = new LinearLayout(this);
      View view2 = view;
      view2.setOrientation(1);
      InputStream inputStream = (InputStream) null;
      try {
            inputStream = getAssets().open("background.jpg");
      } catch (IOException e4) {
            IOException iOException = e4;
      }
      if (inputStream != null) {
            view2.setBackgroundDrawable(Drawable.createFromStream(inputStream, ""));
      }
      TextView textView = r24;
      TextView textView2 = new TextView(this);
      this.tv = textView;
      this.tv.setTextSize((float) 20);
      this.tv.setText("1\n2\n3\n4\n5format\n6\n7\n8\n9\n");
      TextView textView3 = this.tv;
      StringBuffer stringBuffer = r24;
      StringBuffer stringBuffer2 = new StringBuffer();
      textView3.append(stringBuffer.append("你的ID:").append(this.id).toString());
      view2.addView(this.tv);
      EditText editText = r24;
      EditText editText2 = new EditText(this);
      this.edit = editText;
      view2.addView(this.edit);
      view = r24;
      linearLayout = new Button(this);
      View view3 = view;
      view3.setText("复制ID");
      view = view3;
      View.OnClickListener onClickListener = r24;
      100000000 100000000 = new 100000000(this);
      view.setOnClickListener(onClickListener);
      view2.addView(view3);
      Button button = r24;
      Button button2 = new Button(this);
      this.enter = button;
      this.enter.setText("进入");
      view2.addView(this.enter);
      Button button3 = this.enter;
      onClickListener = r24;
      100000002 100000002 = new 100000002(this, defaultSharedPreferences, date3);
      button3.setOnClickListener(onClickListener);
      button3 = r24;
      button = new Button(this);
      button3 = button3;
      setContentView(view2);
    }
}

页: [1]
查看完整版本: 求帮写注册机