You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -89,6 +90,8 @@ Create a JSON configuration file for complex scenarios:
89
90
"renameClasses": true,
90
91
"renameFields": true,
91
92
"renameMethods": true,
93
+
"renameLocalVariables": true,
94
+
"obfuscateConditions": true,
92
95
"namingMode": "RANDOM_SHORT",
93
96
"verbose": true,
94
97
"keepRules": {
@@ -117,6 +120,8 @@ ObfuscationConfig config = new ObfuscationConfig.Builder()
117
120
.renameClasses(true)
118
121
.renameFields(true)
119
122
.renameMethods(true)
123
+
.renameLocalVariables(true)
124
+
.obfuscateConditions(true)
120
125
.namingMode(NamingMode.RANDOM_SHORT)
121
126
.verbose(true)
122
127
@@ -194,6 +199,101 @@ ObfuscationConfig config = new ObfuscationConfig.Builder()
194
199
.build();
195
200
```
196
201
202
+
## Condition Obfuscation
203
+
204
+
Condition obfuscation transforms simple boolean constants (`true` and `false`) into mathematically equivalent complex expressions that make the code harder to understand and analyze.
205
+
206
+
### How It Works
207
+
208
+
The transformer replaces simple boolean constants with arithmetic expressions that evaluate to the same value:
209
+
210
+
**Original Code:**
211
+
```java
212
+
if (someFlag ==true) {
213
+
doSomething();
214
+
}
215
+
boolean result =false;
216
+
```
217
+
218
+
**Obfuscated Code:**
219
+
```java
220
+
// true becomes: 2 - 1
221
+
if (someFlag == (2-1)) {
222
+
doSomething();
223
+
}
224
+
// false becomes: 1 - 1
225
+
boolean result = (1-1);
226
+
```
227
+
228
+
### Features
229
+
230
+
-**Safe Transformation** - Only transforms constants that are likely to be boolean conditions (10% probability to avoid breaking non-boolean integer usage)
231
+
-**Multiple Strategies** - Uses various mathematical expressions to avoid patterns
232
+
-**Stackmap-Safe** - Generates bytecode that passes JVM verification
233
+
-**Conservative Approach** - Only targets simple constant loading to maintain program correctness
0 commit comments