Configuration
You can configure Dynamic Proxy from the command-line interface (CLI), the MSBuild Babel task, or Babel Desktop.
Command Line
Babel Obfuscator provides the option to enable dynamic proxy protection through the use of the --proxy switch in the command-line interface. This switch allows you to configure Babel to generate proxies for external and internal method calls. You can also specify the list of dynamic proxy filters, depending on your specific requirements.
The following command line configures Babel Obfuscator to generate dynamic proxies only for external method calls.
babel myapp.exe --proxy externalThe example below will make Babel Obfuscator generate dynamic proxies for external and internal method calls.
babel myapp.exe --proxy allThis command line sets some dynamic proxy filter expressions (see Filters).
babel myapp.exe --proxy ICollection.* --proxy IEnumerator.*MSBuild Babel Task
<PropertyGroup>
<DynamicProxy>external=true;internal=true;true</DynamicProxy>
<DynamicProxyCallFilters>ICollection.*;IEnumerator.*</DynamicProxyCallFilters>
</PropertyGroup>
<Babel DynamicProxy="$(DynamicProxy)"
DynamicProxyCallFilters="$(DynamicProxyCallFilters)" />Babel Desktop
Select the assembly on the project canvas and, in the properties panel, set DynamicProxy in the Code encryption group to the type of dynamic proxy to generate. The DynamicProxyCallFilters option in the same group takes the list of call filters. See Obfuscation Projects for how to work with projects in Babel Desktop.
You can also define the call filters per rule: open the XML rules view for the assembly in Babel Desktop and create a new rule or modify an existing one to include the desired filters. Within the XML rule properties, specify the regular expressions that correspond to the method calls you want to proxy.
<Rules>
<Rule name="rule1" feature="dynamic proxy" exclude="false" applyToMembers="true">
<Pattern>*</Pattern>
<Description>Set Dynamic Proxy Call Filters</Description>
<Properties>
<DynamicProxyCallFilters>IEnumerator.*</DynamicProxyCallFilters>
</Properties>
</Rule>
</Rules>