|
8 | 8 | import net.cvs0.config.ConfigLoader;
|
9 | 9 | import net.cvs0.config.NamingMode;
|
10 | 10 | import net.cvs0.mappings.export.MappingExporter;
|
| 11 | +import net.cvs0.utils.AntiDebugger; |
11 | 12 | import net.cvs0.utils.Logger;
|
12 | 13 |
|
13 | 14 | import java.io.File;
|
@@ -45,6 +46,9 @@ public class Main implements Callable<Integer>
|
45 | 46 | @Option(names = {"--obfuscate-conditions"}, description = "Enable condition obfuscation (transforms true/false into complex expressions)")
|
46 | 47 | private Boolean obfuscateConditions;
|
47 | 48 |
|
| 49 | + @Option(names = {"--compress-strings"}, description = "Enable string compression (compresses string literals using deflate/base64)") |
| 50 | + private Boolean compressStrings; |
| 51 | + |
48 | 52 | @Option(names = {"--mappings", "--output-mappings"}, description = "Output mappings file")
|
49 | 53 | private File mappingsFile;
|
50 | 54 |
|
@@ -84,6 +88,24 @@ public class Main implements Callable<Integer>
|
84 | 88 | " SINGLE_CHAR - Single character names (a, b, c...)")
|
85 | 89 | private NamingMode namingMode;
|
86 | 90 |
|
| 91 | + @Option(names = {"--anti-debugging"}, description = "Enable anti-debugging protection") |
| 92 | + private Boolean antiDebugging; |
| 93 | + |
| 94 | + @Option(names = {"--debugger-action"}, |
| 95 | + description = "Action to take when debugger is detected:%n" + |
| 96 | + " EXIT_SILENTLY - Exit without error%n" + |
| 97 | + " EXIT_WITH_ERROR - Exit with error code%n" + |
| 98 | + " CORRUPT_EXECUTION - Corrupt execution flow%n" + |
| 99 | + " INFINITE_LOOP - Enter infinite loop%n" + |
| 100 | + " FAKE_EXECUTION - Continue with fake behavior") |
| 101 | + private AntiDebugger.DebuggerAction debuggerAction; |
| 102 | + |
| 103 | + @Option(names = {"--generate-score"}, description = "Generate obfuscation resistance score") |
| 104 | + private Boolean generateScore; |
| 105 | + |
| 106 | + @Option(names = {"--sequential-transformers"}, description = "Run transformers sequentially - each transformer processes all classes before the next starts (disabled by default)") |
| 107 | + private Boolean sequentialTransformers; |
| 108 | + |
87 | 109 | public static void main(String[] args)
|
88 | 110 | {
|
89 | 111 | int exitCode = new CommandLine(new Main()).execute(args);
|
@@ -177,6 +199,10 @@ private ObfuscationConfig buildConfiguration() throws Exception
|
177 | 199 | builder.obfuscateConditions(obfuscateConditions);
|
178 | 200 | }
|
179 | 201 |
|
| 202 | + if (compressStrings != null) { |
| 203 | + builder.compressStrings(compressStrings); |
| 204 | + } |
| 205 | + |
180 | 206 | if (verbose) {
|
181 | 207 | builder.verbose(true);
|
182 | 208 | }
|
@@ -206,6 +232,22 @@ private ObfuscationConfig buildConfiguration() throws Exception
|
206 | 232 | builder.namingMode(namingMode);
|
207 | 233 | }
|
208 | 234 |
|
| 235 | + if (antiDebugging != null) { |
| 236 | + builder.antiDebugging(antiDebugging); |
| 237 | + } |
| 238 | + |
| 239 | + if (debuggerAction != null) { |
| 240 | + builder.debuggerAction(debuggerAction); |
| 241 | + } |
| 242 | + |
| 243 | + if (generateScore != null) { |
| 244 | + builder.generateScore(generateScore); |
| 245 | + } |
| 246 | + |
| 247 | + if (sequentialTransformers != null) { |
| 248 | + builder.sequentialTransformers(sequentialTransformers); |
| 249 | + } |
| 250 | + |
209 | 251 | if (configFile == null && renameClasses == null && renameFields == null && renameMethods == null && renameLocalVariables == null) {
|
210 | 252 | builder.renameClasses(true)
|
211 | 253 | .renameFields(true)
|
|
0 commit comments