|
|
|
|
|
|
|
Name obfuscation
|
|
|
The menus for class, method and field names are used when specifying which classes, methods or fields are to have their names changed. This approach to selective obfuscation based on access level, has been adopted to provide a maximum amount of flexibility with an easy to use interface. For example, if the Class files to be obfuscated are part of an API then the methods that are of interest to programmers using the API package, would be declared public. By selecting 'All non-public' for methods, the names for these methods of interest will remain unchanged, while the rest will undergo obfuscation. On the other hand if none of the methods is meant to be accessible by other programs then the maximum level of obfuscation may be achieved by selecting 'All methods'. Smokescreen also allows for the exclusion of specific names from obfuscation when using a directives file. When renaming a class Smokescreen will also attempt to rename the package where possible. If a class cannot be renamed then its package name will remain the same. The package part of the class name is either renamed or kept the same consistently for all classes in the same package.
Note that Smokescreen may not change the names of certain references in some special cases. For instance, any method with the "main" method signature, the constructors or class initializers, will not be changed. Any symbolic name that matches a string constant exactly, will also not be renamed. Smokescreen also has some standard exclusions for methods and fields that will not be renamed in order to support Serialization and RMI.
|
|
|
|
|
Removal of unused members
|
|
|
The removal of unused methods and fields is accomplished by selecting the 'Remove unused methods' checkbox or the 'Remove unused fields'. Methods and fields that cannot be referenced by executing the code, will be considered for removal. If a method or field name cannot have its name changed based on name obfuscation settings then it will not be removed. This means that turning off method name obfuscation by selecting 'Don't obfuscate' will prevent the removal of any unused methods, regardless of the state of the 'Remove unused methods' checkbox. If the user selects 'All non-public' and 'Remove unused methods' from the 'Method obfuscation' menu, then all non-public methods will be candidates for name obfuscation, and a subset of these will be considered for removal. The same rules apply when removing unused fields.
|
|
|
|
|
Control flow obfuscation
|
|
|
The bytecode obfuscation operates on the bytecode for each method, the bytecode for the method is changed depending on one or more selections made in the 'Bytecode' menu. Here again Smokescreen may not make changes to the bytecode in special cases, say for example if there is insufficient bytecode in the method to start with.
Selecting 'Shuffle stack operations' causes certain stack operations that pop a value into a local variable, to be delayed, so that they are executed after other stack instructions. This makes it more difficult for decompilers to determine where the value on the stack actually came from.
Selecting 'Add fake exceptions' will introduce fake exception blocks into the bytecode where possible. The exception blocks will be set up so as to partly overlap with existing blocks of code, so that they are partly inside and partly outside of existing control blocks. This makes the control flow of the method, much more difficult to determine, as it does not correspond to regular java source code.
Selecting 'Change switch statements' will change the control flow leading to switch statements. By adding instructions the obfuscator will attempt to make it appear that control flow goes directly to one of the 'case' statements without going through the 'switch' statement.
|
|
|
|
|
String encryption
|
|
|
Selecting 'String encryption' will change string constants that are present in the class file. This means that the original string literals will no longer exist in the obfuscated class.
|
|
|
|
|
Optional information
|
|
|
Optional information such as line number table attributes, and local variable table attributes are always removed from class files, regardless of whatever obfuscation parameters are selected.
|
|
|
|
|
Specifying the locations of superclasses
|
|
|
When obfuscating the references used in a class file, Smokescreen must be able to look up the names of references in its super classes. These locations are specified by the user, by selecting 'Superclass path' in the 'File' menu. The text window that is displayed may be used to enter the paths to super classes that are required. The user may enter all the paths in one long line, using a semi-colon as a path separator, or have each path on a separate line for better readability.
Each path can specify either a directory, a Jar file, or a Zip file. If a directory is specified then all Class files, Jar files and Zip files in that directory are searched for superclasses. If a Zip file or Jar file is specified then all it's entries are searched for superclasses. Note that when searching a directory for super classes, Smokescreen will not search its sub-directories unless they have also been specified in the superclass path. The panel also includes a 'Use Class Loader' checkbox, which can be checked to indicate that superclasses are to be found in the search path for loading classes.
|
|
|
|
|
The log file
|
|
|
Each session of Smokescreen will overwrite the file 'SmokescreenLog.txt'. This file may contain information regarding the obfuscations performed in that session, such as the settings used for obfuscations and a record of the name changes and removals performed. If an error occurs during obfuscation this will also be reported in the log file. If the information in the log file needs to be saved for future reference, then this should be done immediately after the Smokescreen session, since it will be overwritten when Smokescreen is started up again. If the 'Log changes' checkbox in the 'File' menu is checked then the name changes will be recorded in the log file. If it is unchecked then name changes will not be recorded but removal information will still be included. The log file should always be checked after each obfuscation session for any errors or warnings that may not be reported on the activity panel.
|
|
|
|
|
|
|