Graphical Rules Editor
Many of the panels in DashO's user interface are rule editors, primarily for including and excluding elements in your application in an obfuscation transformation. A rule editor is divided into two lists – a class list on the left hand side that shows the classes and members of the inputs and a rule list on the right. The rules specify what parts of the inputs are affected by the operation and in some cases the actions to be taken. The rules editor is used to set rules for the following operations:
Other parts of DashO, such as entry points, use an interface very similar to the rule editor.
There are several ways to create rules in the interface:
Right-click items in the class list – you can right-click on items in the class list to bring up a contextual menu. From there you can build a rule that will match the item that you have selected. If you hold down the shift key when you create the rule the rule will be made a regular expression. If you create a rule for a method or a field, DashO will add the new rule to a pre-existing class rule or create one if needed.
Drag and drop items from the class list – you can drag an item from the class list and drop it on the rules. If you drag and drop either a method or a field, DashO will add the new rule to a pre-existing class rule or create one if needed.
Using the buttons – You can click the New buttons to the right of the rules list to create a new entry.
Using the contextual menu - You can click the New buttons on the contextual menu to create a new entry.
The basic parts of a rule can be modified directly in the editor. The name of any item and the signature or methods can be changed by using the text field immediately below the rules list. Specialized editors may also provide for direct editing of their values.
When a rule is created using the New buttons or the contextual menu, the editor will be launched allowing you to edit all of the settings for the rule.
You have several options to access all the settings for a rule after the rule is created:
Right-click on the rule and select the Edit... item on the contextual menu
Double-click on the rule
Select the rule and press the Enter key
Select the rule and click the Edit... button
This will bring up the editor for the rule. In the editor you will find the settings for values such as:
Modifiers – the Java modifiers, or their negation, which are required for this rule to match an item. See the description of the Modifiers attribute for values you can use here.
Name – the name of the item that the rule affects. This can be a constant value, a pattern, or a regular expression.
Signature – the signature for methods.
Type – determine how the name and/or signature are to be interpreted. See Patterns and Regular Expressions for details.
Select class – For rules that affect the class itself as well as its members, this setting determines if the rule applies to the class, or if the class is just a container for nested field or method rules.
Renaming controls – Entry points are non-renameable by default. Some types of entry points can be made renameable and these controls determine if the class and/or its members can be renamed.
Property - For the properties panel, a property you want to create and/or assign a value to.
Value - For the properties panel, the value assigned to the property.
Source - For non-class files, this is the path to the non-class file.
Destination - For non-class files, this is the desired output destination.
You can use the preview function to determine what will be affected by the rules. You can elect to preview a single rule or all rules. Right-click a rule to bring up the contextual menu and select Preview Rule or Preview All. The items in the class list that will be affected by the rule will be displayed in bold. You can use the contextual menu in either list to clear the highlighting.
Patterns and Regular Expressions
A simple rule selects a particular item, such as a class, using the name of the item literally. A rule can also select items by using patterns or regular expressions. See Patterns and Regular Expressions.
Regular Expressions are checked automatically. If your expression has an error a red X will be displayed next to it. Move the pointer over the rule and the tooltip will display the location of the error and its description.
Regular expressions apply to the rule as a whole. If a class name is specified as a regular expression, all member names will be treated as regular expression. Patterns do not have this restriction.
Combining Include and Exclude Rules
DashO can use a combination of inclusion and exclusion to determine what parts of your application to obfuscate. When an obfuscation transformation allows for the definition of both includes and exclude it is important to remember how the two are combined:
If no include rules are defined, all items are included by default.
If no exclude rules are defined, no items are excluded by default.
Includes are determined first, then excludes. An item must be included by at least one rule and not excluded by any rule to have a transformation apply to it.