An example using every statement and parameter with color coding
/*****************************************************************************/
/* Sample ZKM Script using every statement and parameter */
/*****************************************************************************/
classpath ".;c:\jdk1.4.0\jre\lib\rt.jar";
open "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
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 extends pack2.Class2 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 pack2.Class2
pack1.* *(*) and //Don't flow obfuscate any method in package pack1
pack1.*; //Don't flow obfuscate methods or add special fields to pack1 classes
obfuscateFlowUnexclude pack1.Class0 foo(int); //Unexclude method "foo(int)" in pack1.Class0
stringEncryptionExclude pack2.Class2 and //Don't string encrypt any String literals in pack2.Class2
*.* public *; //Don't string encrypt the value of any public field
stringEncryptionUnexclude pack2.Class2 foo; //Unexclude field "foo" in pack2.Class2
existingSerializedClasses pack2.Class2; //Changes to pack2.Class2 must be Serialization compatible
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
accessedByReflection pack1.Class2 foo(*); //All methods in pack1.Class2 named "foo" accessed by Reflection
accessedByReflectionExclude pack1.Class2 foo(int[]); //foo(int[]) NOT accessed by Reflection
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=flowObfuscate //could be omitted. Default is flowObfuscate
exceptionObfuscation=light //could be omitted. Default is light
autoReflectionHandling=normal //Default is none for backwards compatability
autoReflectionPackage="pack0" //Put autoReflection lookup class into package "pack0"
autoReflectionHash="SHA-512" //Use SHA-512 hash in autoReflection lookup class
collapsePackagesWithDefault="xyz" //could be omitted. Default is to not collapse packages
lineNumbers=delete //could be omitted. Default is delete
localVariables=delete //could be omitted. Default is delete
newNamesPrefix="Z" //Prefix all newly generated names with "Z"
randomize=false //could be omitted. Default is false
allClassesOpened=true //could be omitted. Default is true
deriveGroupingsFromInputChangeLog=false //could be omitted. Default is false
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
resetStringEncryptionExclusions; //remove effect of any preceding stringEncryptionExclude
resetExistingSerializedClasses; //remove effect of any preceding existingSerializedClasses
resetFixedClasses; //remove effect of any preceding fixedClasses
resetGroupings; //remove effect of any preceding groupings
resetAccessedByReflection; //remove effect of any preceding accessedByReflection
//and accessedByReflectionExclude
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 "c:\Temp";
|