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. A new rule will be created with a dummy name that you can edit.
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.
To access all the settings for a rule, right-click on the rule and select the Properties item on the contextual menu. In the properties box 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.
Values for annotations – Virtual annotations can contain many specialized values. Some contain only a generic value – use the tooltip display to determine its use. Annotations that perform an action will also have a where value. This determines the location in the method where the action will take place.
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.