Question

im using proguard and hiding my code.. and id seem to work... 'half'. i just want it not decoded, and to be worked, and privates to be not seen by jad..

here's my java code

package kr.pkgcls;

public class sums {
    private int margin;
    private int resVal;
    public sums(){
        margin = 10;
        resVal = 0;
    }
    public sums(int a){
        margin = a;
        resVal = 0;
    }
    private void eval_internal(){
        margin++;
        for(int i = 0; i<margin; i++){
            resVal += i;
        }
    }
    public int eval(){
        //error!! when use "return eval_internal()", it exposes..
        eval_internal();
        return resVal;
    }
}

and here's my .pro data

#input file
-injars sumslib.jar
#output file
-outjars sumslib2.jar
#lib
-libraryjars <java.home>/lib/rt.jar
#basic ignores
-dontoptimize
-dontshrink
-dontusemixedcaseclassnames
-target 1.6
-verbose
-keep public class kr.pkgcls.**{
    public protected *;
}
#-dontskipnonpubliclibraryclasses
#below makes error 
#-keepparameternames
#-keepclasseswithmembernames public class *{
#   public void sums();
#   public void sums(int);
#   public int eval();
#}
#-keepclasseswithmembernames class kr.pkgcls.**{
#   public **(***); 
#}
#keepclasseswithmembernames public class *{
#}
#external file name input
-obfuscationdictionary dic.txt
-classobfuscationdictionary dic.txt
-packageobfuscationdictionary dic.txt

and here's my jad output.

   // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) radix(10) lradix(10) 

package kr.pkgcls;


public class sums
{

    public sums()
    {
        i = 10;
        l = 0;
    }

    public sums(int j)
    {
        i = j;
        l = 0;
    }

    private void i()
    {
        i++;
        for(int j = 0; j < i; j++)
            l += j;

    }

    public int eval()
    {
        i();
        return l;
    }

    private int i;
    private int l;
}

seem to work, as privates are modified to another method names, while others are not, but IT IS DECODED!!! is there somethin wrong with my .pro options? or.. is it because this code is so simple?

help me out guys ;-<

Was it helpful?

Solution

Everything works as it should; Proguard can't "hide" code. It can only make it harder to understand.

That said: Don't waste time and money on tools like that. 1. Won't stop dedicated people. 2. Only part of the knowledge is in the code. When someone tries to "steal" (how do you "steal" an idea? Ideas only grow when they spread) the code, they still have to start from scratch while you have all the knowledge. They will need more time than you to add features or to build a new product from it, for example.

If you find a product that looks suspiciously like your work, you can always sue them in court for copyright infringement - if you can prove that the code is yours. If you can't prove it, obfuscation is futile.

So unless you have to use tools like that, they don't offer any real value.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top