CalebFenton / simplify

Android virtual machine and deobfuscator
Other
4.41k stars 438 forks source link

Chinese string decryption scramble code #124

Closed lozn00 closed 4 years ago

lozn00 commented 4 years ago

Provide link to specific APK, DEX, or file hash Please make it easy to get the exact same file you're having trouble with. Please don't link to Google Play or another market since it's not always possible to get the specific version you're having trouble with. https://moody88.ctfile.com/fs/15323259-391099259 Describe the bug Please include error logs.

To Reproduce How did you run simplify? java -jar simplify-1.2.1.jar app-debug.apk Attempted work-arounds Did you try any work-arounds?

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

package com.example.emptyencryptapp;

import android.app.Activity;
import android.os.Bundle;
import android.widget.Toast;

import java.io.UnsupportedEncodingException;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Toast.makeText(this, BytesEncrypt.decode(new byte[]{(byte) -43, (byte) -34, (byte) -4, (byte) -36, (byte) -50, (byte) -81, (byte) -41, (byte) -23, (byte) -15, (byte) -36, (byte) -23, (byte) -88}, BytesEncrypt.decode(new byte[]{(byte) 4, (byte) 83, (byte) 81, (byte) 0, (byte) 0, (byte) 81}, "5209cf")), Toast.LENGTH_LONG).show();
    }
    //PVwoMCIcWVRfBg==
}
public class OooOO0OO {
    public static byte[] encode(byte[] bytes, String key) {
        int len = bytes.length;
        int keyLen = key.length();
        for (int i = 0; i < len; i++) {
            bytes[i] = (byte) (bytes[i] ^ key.charAt(i % keyLen));
        }
        return bytes;
    }

    public static String OooOOoo0oo(byte[] bytes, String key) {
        int len = bytes.length;
        int keyLen = key.length();
        for (int i = 0; i < len; i++) {
            bytes[i] = (byte) (bytes[i] ^ key.charAt(i % keyLen));
        }
        return new String(bytes);
    }
}

result:


public class MainActivity extends Activity {
    /* Access modifiers changed, original: protected */
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toast.makeText(this, "淇濆瓨鎴愬姛", 1).show();//This is not Chinese at all. Chinese is 更新成功
    }
}
CalebFenton commented 4 years ago

While I appreciate the bug reports, truly, please try and fill out the bug template. I can show you the math proving how this increases your chances of the bug getting fixed. For all I know, simplify is crashing on unrelated code and you didn't try any of the work arounds.

CalebFenton commented 4 years ago

Thanks for adding the template. At first glance, this looks like something simplify should work with.

CalebFenton commented 4 years ago

The link doesn't work anymore. @qssq, do you have the file hash or an updated link?

CalebFenton commented 4 years ago

Closing because sample isn't available.

CalebFenton commented 4 years ago

I tried to reproduce with the code you helpfully posted. I got this:

package org.cf.demosmali;

public class Issue124 {

  public static String testyTest() {
    String msg = decode(
        new byte[]{(byte) -43, (byte) -34, (byte) -4, (byte) -36, (byte) -50, (byte) -81, (byte) -41, (byte) -23, (byte) -15, (byte) -36, (byte) -23,
            (byte) -88}, decode(new byte[]{(byte) 4, (byte) 83, (byte) 81, (byte) 0, (byte) 0, (byte) 81}, "5209cf"));
    return msg;
  }

  public static byte[] encode(byte[] bytes, String key) {
    int len = bytes.length;
    int keyLen = key.length();
    for (int i = 0; i < len; i++) {
      bytes[i] = (byte) (bytes[i] ^ key.charAt(i % keyLen));
    }
    return bytes;
  }

  public static String decode(byte[] bytes, String key) {
    int len = bytes.length;
    int keyLen = key.length();
    for (int i = 0; i < len; i++) {
      bytes[i] = (byte) (bytes[i] ^ key.charAt(i % keyLen));
    }
    return new String(bytes);
  }
}

And testyTest simplifies to:

Screen Shot 2020-06-13 at 8 59 29 AM

Without the sample, I'm thinking the problem is with the decompiler you're using.