lundi 18 avril 2016

how to obfuscate reflection code using Zelix klassMaster tool

I'm using the Zelix KlassMaster evaluation version and now has a problem with the refection feature.As my program will load a class which is defined in a xml file (for example, com.xxx.xxx.A), and I hava defined " accessedByReflection com.xxx.xxx.A; " in the ZKM script .But when I run my program, it is still failed. The error is "Caused by: java.lang.ClassNotFoundException: com.xxx.xxx.A " . I wonder whether my ZKM script is written correct or the evaluation version don't support the refection feature. So how can I obfuscate the reflection classes and meanwhile my program can find the new class name after obfuscation? where and how the mapping information is stored and loaded when the class is running?

my ZKM script is like as following:

classpath   "ZKM.jar"
            "/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/resources.jar"
            "/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/rt.jar"
            "/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jsse.jar"
            "/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jce.jar"
            "/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/charsets.jar"
            "classes/obfuscate/*"
            "classes/Non_obfuscate/*";

open        "/home/xxx/target/classes/*"
            "classes/obfuscate/*";

exclude     public *.*^ containing {public static main(java.lang.String[])} public static main(java.lang.String[]);

obfuscate   changeLogFileIn=""
            changeLogFileOut="ChangeLog.txt"
            obfuscateFlow=light
            exceptionObfuscation=light
            encryptStringLiterals=enhanced
            mixedCaseClassNames=ifInArchive
            aggressiveMethodRenaming=true
            collapsePackagesWithDefault=""
            localVariables=delete
            lineNumbers=delete
            autoReflectionHandling=normal
            obfuscateReferences=none
            obfuscateReferenceStructures=inSpecialClass;

accessedByReflection    com.xxx.xxx.A;

saveAll     archiveCompression=all "output";





Aucun commentaire:

Enregistrer un commentaire