An example using every statement and parameter with color coding/*****************************************************************************/ /* Sample ZKM Script using every statement and parameter */ /*****************************************************************************/ classpath ".;c:\jdk1.8.0\jre\lib\rt.jar"; ignoreMissingReferences pack9.Class9 *(*); //ignore missing methods in pack9.Class9 //must precede the open statement open openNestedArchives=true //open nested archives. This is the default. "c:\directory1\Class1.class" //load a specific class "c:\directory1\MyZip.zip" //load all classes in a zip file "c:\directory1\MyJar.jar" //load all classes in a jar file "c:\directory2" //load all classes in a specific directory "c:\directory3\*"; //load all classes in a directory and its subdirectories trimExclude pack1.Class1^ public static main(java.lang.String[]) and pack2.*.* public *(*); trimUnexclude pack2.pack3.* public method(*); //Don't exclude public methods in pack2.pack3 trim deleteSourceFileAttributes=false //could be omitted. Default is false deleteDeprecatedAttributes=true //could be omitted. Default is true deleteAnnotationsAttributes=false //could be omitted. Default is false deleteExceptionAttributes=false //could be omitted. Default is false deleteUnknownAttributes=false; //could be omitted. Default is false removeMethodCallsInclude java.lang.System print*(*); //Remove System print calls //Don't remove printStackTrace calls removeMethodCallsExclude java.lang.System printStackTrace(*); removeMethodCalls java.lang.System printStackTrace(*); //Remove the specified method calls //Remove effect of preceding removeMethodCallsInclude & removeMethodCallsExclude resetRemoveMethodCalls; exclude p*2.* and p*.C*1 and *.Class2 implements pack3.Class3, pack4.Class4 and @pack2.MyAnnotation *.* @pack2.MyAnnotation *(@*.* int, *) and public abstract *.* private transient java.lang.String f* and *.* extends pack2.Class2 public native m*(*) and *.<link>_Skel implements pack3.Class3 search pack4, pack4.p*5; unexclude pack2.Class4; //Don't exclude pack2.Class4 obfuscateFlowExclude pack2.Class2 method1() and //Don't flow obfuscate method1() in Class2 pack1.* *(*) and //Don't flow obfuscate any method in package pack1 pack1.*; //Don't flow obfuscate methods or add special members to pack1 classes obfuscateFlowUnexclude pack1.Class0 foo(int); //Unexclude method "foo(int)" in pack1.Class0 obfuscateExceptionsExclude pack2.Class2 method1() and //Don't exception obfuscate method1() in Class2 pack1.* *(*) and //Don't exception obfuscate any method in package pack1 pack1.*; //Don't exception obfuscate methods or add special members to pack1 classes obfuscateExceptionsUnexclude *.* foo(int); //Unexclude all methods "foo(int)" stringEncryptionExclude pack2.Class2 and //Don't string encrypt any String literals in Class2 *.* public * and //Don't string encrypt the value of any public field *.* public *(*); //Don't string encrypt Strings in any public method stringEncryptionUnexclude pack2.Class2 foo; //Unexclude field "foo" in pack2.Class2 integerEncryptionExclude pack2.Class2 and //Don't encrypt any integer constants in Class2 *.* public * and //Don't integer encrypt the value of any public field *.* public *(*); //Don't integer encrypt integers in any public method integerEncryptionUnexclude pack2.Class2 foo; //Unexclude field "foo" in pack2.Class2 longEncryptionExclude pack2.Class2 and //Don't encrypt any long constants in Class2 *.* public * and //Don't long encrypt the value of any public field *.* public *(*); //Don't long encrypt longs in any public method longEncryptionUnexclude pack2.Class2 foo; //Unexclude field "foo" in pack2.Class2 //Changes to pack2.Class2 must be Serialization compatible existingSerializedClasses pack2.Class2; fixedClasses pack2.Class2; //Insulates pack2.Class2 from any obfuscation groupings {pack1.* and pack2.*} //1st grouping contains pack1 and pack2 classes {pack3.* and pack4.*}; //2nd grouping contains pack3 and pack4 classes //Asserts that ClassA always initialized before ClassB classInitializationOrder pack3.ClassA > pack3.ClassB; //All methods in pack1.Class2 named "foo" accessed by Reflection accessedByReflection pack1.Class2 foo(*); accessedByReflectionExclude pack1.Class2 foo(int[]); //foo(int[]) NOT accessed by Reflection //Obfuscate all references to a java.lang.System method contained in class "pack0.Class0" obfuscateReferencesInclude containedIn{pack0.Class0 *(*)} java.lang.System *(*); //Exclude references to any method named "println" in java.lang.System that //are contained in class "pack0.Class0" obfuscateReferencesExclude containedIn{pack0.Class0 *(*)} java.lang.System println(*); //All methods in pack1.Class3 named "bar" methodParameterChangesInclude pack1.Class3 bar(*); methodParameterChangesExclude pack1.Class3 bar(int[]); //Exclude bar(int[]) //All methods in pack1.Class3 named "bar" methodParameterObfuscationInclude pack1.Class3 bar(*); methodParameterObfuscationExclude pack1.Class3 bar(int[]); //Exclude bar(int[]) obfuscate changeLogFileIn="ChangeLogIn.txt" //omit parameter if no input change log changeLogFileOut="ChangeLog.txt" //could be omitted. Default is ChangeLog.txt aggressiveMethodRenaming=false //could be omitted. Default is false keepInnerClassInfo=false //could be omitted. Default is false keepGenericsInfo=true //could be omitted. Default is true obfuscateFlow=light //could be omitted. Default is light encryptStringLiterals=enhanced //could be omitted. Default is enhanced encryptIntegerConstants=aggressive //Default is none encryptLongConstants=normal //Default is none exceptionObfuscation=light //could be omitted. Default is light autoReflectionHandling=normal //Default is none for backwards compatibility autoReflectionPackage="pack0" //Put autoReflection lookup class into package "pack0" autoReflectionHash="SHA-512" //Use SHA-512 hash in autoReflection lookup class collapsePackagesWithDefault="xyz" //Default is to not collapse packages obfuscateReferences=normal; //Obsfuscate references obfuscateReferenceStructures=inSpecialClass //Default is to use a special class obfuscateReferencesPackage="pack0" //Put special lookup class into package "pack0" lineNumbers=delete //could be omitted. Default is delete localVariables=delete //could be omitted. Default is delete methodParameters=keepVisible //could be omitted. Default is keepVisible mixedCaseClassNames=ifInArchive //could be omitted. Default is ifInArchive newNameCharacters=ASCII //could be omitted. Default is ASCII newNamesPrefix="Z" //Prefix all newly generated names with "Z" randomize=false //could be omitted. Default is false uniqueClassNames=false //could be omitted. Default is false uniqueMethodNames=false //could be omitted. Default is false newPackageNameFile="obfuscatedPackageNames.txt" //List of obfuscated package names newClassNameFile="obfuscatedClassNames.txt" //List of obfuscated class names newFieldNameFile="obfuscatedFieldNames.txt" //List of obfuscated field names newMethodNameFile="obfuscatedMethodNames.txt" //List of obfuscated method names allowMethodParameterChanges=false //Deprecated - Use methodParameterChanges instead. methodParameterChanges=none //could be omitted. Default is none methodParameterChangesPackage="pack0" //Put lookup class into package "pack0" obfuscateParameters=none //could be omitted. Default is none makeClassesPublic=false //could be omitted. Default is false allClassesOpened=true //could be omitted. Default is true deriveGroupingsFromInputChangeLog=false //could be omitted. Default is false keepBalancedLocks=false //could be omitted. Default is false preverify=true //could be omitted. Default is true assumeRuntimeVersion="8" //Default derived from lowest opened class version legalIdentifiers=true //Deprecated hideFieldNames=false //Deprecated hideStaticMethodNames=false; //Deprecated resetTrimExclusions; //remove the effect of any preceding trimExclude statement resetExclusions; //remove the effect of any preceding exclude statement resetObfuscateFlowExclusions; //remove effect of any preceding obfuscateFlowExclude statement //remove effect of any preceding obfuscateExceptionsExclude statement resetObfuscateExceptionsExclusions; resetStringEncryptionExclusions; //remove effect of any preceding stringEncryptionExclude resetIntegerEncryptionExclusions; //remove effect of any preceding integerEncryptionExclude resetLongEncryptionExclusions; //remove effect of any preceding longEncryptionExclude resetExistingSerializedClasses; //remove effect of any preceding existingSerializedClasses resetFixedClasses; //remove effect of any preceding fixedClasses resetGroupings; //remove effect of any preceding groupings resetClassInitializationOrder; //remove effect of any preceding classInitializationOrder //remove effect of any preceding accessedByReflection and accessedByReflectionExclude resetAccessedByReflection; //remove effect of any preceding obfuscateReferencesInclude and obfuscateReferencesExclude resetObfuscateReferenceExclusions; resetIgnoreMissingReferences; //remove effect of any preceding ignoreMissingReferences //remove effect of any preceding methodParameterChangeInclude or methodParameterChangeExclude resetMethodParameterChangesExclusions; //remove effect of any preceding methodParameterObfuscationInclude //or methodParameterObfuscationExclude resetMethodParameterObfuscationExclusions; exclude *. and //exclude all packages *.* and //exclude all classes *.* * and //exclude all fields *.* *(*); //exclude all methods gc 500; //500 could have been omitted. 500ms sleep is the default. print "About to obfuscate a second time"; //prints to standard out and the log obfuscate; //Using implicit defaults execute "deltree /Y c:\Temp"; //executes a simple OS command saveAll archiveCompression=asIs deleteEmptyDirectories=false deleteXMLComments=false "c:\Temp";  | 
   
| 
          | 
   
| 
          |