Git Product home page Git Product logo

Comments (7)

pxb1988 avatar pxb1988 commented on July 26, 2024

it is a bit strange that class aa is a child class of a final class ab. as in JAVA, extends a final class is not allowed.

Could you please provide the following information:

  1. what version of dex2jar are you using ?
  2. please attach the error log if possible.
  3. please attach the 3 class files (ab.class, aa.class and Decrypt.class) (attach here or send to [email protected])

from dex2jar.

pxb1988 avatar pxb1988 commented on July 26, 2024

I have tried the following code

package res.decrypttest;


public class Decrypt extends aa {
    public static String a = Decrypt.dec("1233asdxcdjdn");
}

class aa extends ab {
}

class ab {
    public static String dec(String str) {
        return new StringBuffer(str).reverse().toString();
    }
}

by running d2j-decrypt-string.sh -mo res.decrypttest.Decrypt -mn dec x.jar -f, the output is

x.jar -> x-decrypted.jar
java.lang.NoSuchMethodException: res.decrypttest.Decrypt.dec(java.lang.String)
        at java.lang.Class.getDeclaredMethod(Class.java:2017)
        at com.googlecode.dex2jar.tools.DecryptStringCmd.findAnyMethodMatch(DecryptStringCmd.java:852)
        at com.googlecode.dex2jar.tools.DecryptStringCmd.loadMethods(DecryptStringCmd.java:765)
        at com.googlecode.dex2jar.tools.DecryptStringCmd.doCommandLine(DecryptStringCmd.java:186)
        at com.googlecode.dex2jar.tools.BaseCmd.doMain(BaseCmd.java:290)
        at com.googlecode.dex2jar.tools.DecryptStringCmd.main(DecryptStringCmd.java:49)
java.lang.NoSuchMethodException: res.decrypttest.aa.dec(java.lang.String)
        at java.lang.Class.getDeclaredMethod(Class.java:2017)
        at com.googlecode.dex2jar.tools.DecryptStringCmd.findAnyMethodMatch(DecryptStringCmd.java:852)
        at com.googlecode.dex2jar.tools.DecryptStringCmd.findAnyMethodMatch(DecryptStringCmd.java:861)
        at com.googlecode.dex2jar.tools.DecryptStringCmd.loadMethods(DecryptStringCmd.java:765)
        at com.googlecode.dex2jar.tools.DecryptStringCmd.doCommandLine(DecryptStringCmd.java:186)
        at com.googlecode.dex2jar.tools.BaseCmd.doMain(BaseCmd.java:290)
        at com.googlecode.dex2jar.tools.DecryptStringCmd.main(DecryptStringCmd.java:49)

two exception stack are printed, but there can be ignored. the finally method ab.dec(String str) is found on the last. the output is genearted, the following java source is decompiled from the Decrypt.class

package res.decrypttest;
public class Decrypt extends aa
{
    public static String a;

    static {
        Decrypt.a = "ndjdcxdsa3321";
    }
}

I will try to mute the exception stack if the method is finally found on next release

from dex2jar.

skypeaful avatar skypeaful commented on July 26, 2024

Yes, the log is NoSuchMethodException but when I test decrypted output there is no string decoded.
I try press build your lastest fix mute exception stack but the build failed. Here is the build log:
https://s3.amazonaws.com/archive.travis-ci.org/jobs/103067410/log.txt
I don't know what is wrong with online build in github?!

from dex2jar.

pxb1988 avatar pxb1988 commented on July 26, 2024

I have temp disabled the 3 failling test cases f548b03,
now the CI build is successfull.
If you want the output file, you have to build locally by ./gradlew distZip,
you can find the output here dex-tools/build/distributions/dex-tools-2.1-SNAPSHOT.zip

from dex2jar.

skypeaful avatar skypeaful commented on July 26, 2024

Hi, I built lastest source dex2jar with gradle-2.10 -> the process is successful but I can't build with apache-maven-3.3.9 (error occurs). I don't know why?
Let's back to main issue:

    invokestatic java.lang.String com.herocraft.sdk.i.r(java.lang.String)
                       com.herocraft.sdk.k.r(java.lang.String)
                       com.herocraft.sdk.n.r(java.lang.String)

to

invokestatic java.lang.String com.herocraft.sdk.j.r(java.lang.String)

to force d2j-decrypt-string correct.
Here is mod file: http://skypeaful.xtgem.com/reversing/dragon_and_dracula_modbytecode.jar
Please fix d2j-decrypt-string for this case because doing manual bytecode take alot time and not work for some biggest class because out of memory.

  • Question No 2:
    Example I have 2 class: Decrypt and aa
    Decrypt.java
public class Decrypt extends aa
{
    public static String a;
    static {
        Decrypt.a = Decrypt.b("123","485",1);
    }
}

aa.java

public class aa
{
  static String b(String string1, String string2, boolean Bool)
  {
// some code here
    String str1 = null;
    return str1;
  }
}

Can you guide me how to emulate (string, string, boolean) for d2j-decrypt-string?
Thank :)
Please help me! I am looking for your answer day by day.

from dex2jar.

pxb1988 avatar pxb1988 commented on July 26, 2024

For Q1,

it is not necessary to modify the bytecode, you can mark all the three methods as decrypt method, because d2j-decrypt-string.sh support decrypt multiple methods at once

 -m,--methods <cfg>                   a file contain a list of methods, each lin
                                      e like: La/b;->decrypt(III)Ljava/lang/Stri
                                      ng;

here is the command line I have used to decrypt strings on your case

d2j-decrypt-string.sh -m config.txt dragon_and_dracula_orginal.jar -cp javax.lib.jar -f

while the content of config.txt is

Lcom/herocraft/sdk/j;->r(Ljava/lang/String;)Ljava/lang/String;
Lcom/herocraft/sdk/i;->r(Ljava/lang/String;)Ljava/lang/String;
Lcom/herocraft/sdk/k;->r(Ljava/lang/String;)Ljava/lang/String;
Lcom/herocraft/sdk/n;->r(Ljava/lang/String;)Ljava/lang/String;
Lcom/herocraft/sdk/j;->b(Ljava/lang/String;Ljava/lang/String;Z)Ljava/lang/String;

For Q2,

It is ok to emulate a method with complex arguments, as mentioned by the wiki https://github.com/pxb1988/dex2jar/wiki/DecryptStrings, the following to arguments on d2j-decrypt-string.sh can be used

 -pd,--parameters-descriptor <type>   the descriptor for the method which can de
                                      crypt the stings, example1: Ljava/lang/Str
                                      ing; example2: III, default is Ljava/lang/
                                      String;
 -t,--arg-types <type>                comma-separated list of types:boolean,byte
                                      ,short,char,int,long,float,double,string. 
                                      Default is string

if you want decrypt the aa.b(String,String,boolean) method, you can either use

d2j-decrypt-string -mo aa -mn b --arg-types string,string,boolean in.jar

or

d2j-decrypt-string -mo aa -mn b --parameters-descriptor 'Ljava/lang/String;Ljava/lang/String;Z' in.jar

or

echo 'Laa;->b(Ljava/lang/String;Ljava/lang/String;Z)Ljava/lang/String;' > config.txt
d2j-decrypt-string --methods config.txt in.jar

And I have update the code to add -v,--verbose argument to print more information.
two invocation are fail to decrypt due to

error 1

java.lang.NullPointerException
        at com.herocraft.sdk.j.d(Unknown Source)
        at com.herocraft.sdk.j.b(Unknown Source)

error 2

java.lang.NoClassDefFoundError: com/sun/midp/rms/RecordStoreFile
        at javax.microedition.rms.RecordStore.openRecordStore(Unknown Source)
        at com.herocraft.sdk.j.u(Unknown Source)
        at com.herocraft.sdk.j.r(Unknown Source)

you have to fix these two error by yourself

from dex2jar.

skypeaful avatar skypeaful commented on July 26, 2024

Thank for your guide. Everything is working fine now :)

from dex2jar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.