leo hibara
leo hibara

Reputation: 1

How can i decompile a java code correctly?

I am trying to decompile this java source code, but it always comes with a syntax i do not understand.

I have tried to decompile it using Procyon v0.5.36 but i get file like this:

do.java
case.java
if.java
.
.
...

Those files contains a syntax that i don't understand and never seen before like this:

public class if implements do
{
    public static volatile int if;
    public static volatile int for;
    public static volatile boolean int;
    private static final int try = 5;
    private static final int byte = 5;
    private static final int case = 8;
    public static final int new = 50;
    
    public for do() {
        case case1 = null;
        try {
            final tech.platform.this.do int1 = tech.platform.this.do.int();
            if (int1 == null) {
                throw new tech.platform.char.do("Page not found !");
            }
            case1 = new case(int1.break().getInt("processNum"));
            if (case1.protected()) {
                throw new tech.platform.char.do("No ID found !");
            }
            case1.for = tech.platform.this.do.int().case() + "_" + tech.platform.this.do.int().char() + "_" + tech.platform.this.do.int().else();
            case1.class = new Timestamp(Calendar.getInstance(TimeZone.getTimeZone("GMT")).getTimeInMillis());
            case1.if = "In Progress";
            case1.void = "0%";
            case1.break = 0;
            case1.catch = 0;
            case1.boolean();
            default default1 = (default)tech.platform.const.do.if(default.class, "name = ?", new Object[] { "SERVICE" });
            if (default1 == null || default1.protected()) {
                default1 = new default();
                default1.for = "SERVICE";
                default1.if = "Activated";
                default1.int = tech.platform.this.do.int().goto().byte;
                default1.try = new Date(System.currentTimeMillis());
                default1.new = tech.platform.this.do.int().goto().byte;
                default1.byte = new Date(System.currentTimeMillis());
                default1.do = default1.throws();
            }
...

This is an example of the source code i am getting, as you can see, there is keywords used as variables and functions names. I guessed that might be a type of source code encryption and protection.

What kind of encryption/protection is that?

Upvotes: 0

Views: 1038

Answers (1)

Stephen C
Stephen C

Reputation: 718758

What kind of encryption/protection is that?

It is called obfuscation. There are commercial tools that do this kind of thing. People who sell or distribute proprietary software use this kind of tool when they do not want you reverse engineering their code.

Software that has been obfuscated is typically covered by a software license agreement; e.g. a click-through EULA. If you check the software license, you will most likely find that reverse engineering is forbidden.

How can i decompile a java code correctly?

Ummm. It depends on what you mean by correctly.

Clearly, one of the things that the obfuscator used here has done is to use replace the names of some of the Java identifiers in the bytecode file with Java keywords. Just to be difficult! It may be possible to work around that by using a different decompiler, but I can't recommend one.

But even once you get past this problem, the obfuscator will have used other techniques to make the code difficult to understand. Certainly, you won't be able to recover the original source code.


I have found that jar file on a website two months ago, i would be glad if i could find the owner, but i don't seem to be able to do so.

That is unfortunate. My recommendation would be to stop trying to use this code!!

Here's the thing: if you are using some JAR file you found on some website and you can't track down the author, you are potentially putting yourself at risk from at least two perspectives:

  1. You have no real way of knowing what the code is actually going to do to your machine when you run it. It might install a backdoor. It might look for and steal credit card details. It might encrypt all of your files and demand a ransom to decrypt them.

  2. This could be a copyright troll thing; see https://en.wikipedia.org/wiki/Copyright_troll.

Upvotes: 1

Related Questions