diff options
| author | 2015-03-23 16:26:44 -0400 | |
|---|---|---|
| committer | 2015-03-23 16:26:44 -0400 | |
| commit | 902b1b519f8ae89910f6f0d9f077738711349324 (patch) | |
| tree | 1ce8a1d05e8797a62ae0d5391ae5b3c951e19b5d /src/cuchaz/enigma/Deobfuscator.java | |
| parent | repackage for 0.10.3 beta (diff) | |
| download | enigma-fork-0.10.3_beta.tar.gz enigma-fork-0.10.3_beta.tar.xz enigma-fork-0.10.3_beta.zip | |
add protectifier! Muwahahaha!!!v0.10.3_beta
Diffstat (limited to 'src/cuchaz/enigma/Deobfuscator.java')
| -rw-r--r-- | src/cuchaz/enigma/Deobfuscator.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/cuchaz/enigma/Deobfuscator.java b/src/cuchaz/enigma/Deobfuscator.java index b63f163..82ce6a2 100644 --- a/src/cuchaz/enigma/Deobfuscator.java +++ b/src/cuchaz/enigma/Deobfuscator.java | |||
| @@ -45,6 +45,7 @@ import cuchaz.enigma.analysis.JarIndex; | |||
| 45 | import cuchaz.enigma.analysis.SourceIndex; | 45 | import cuchaz.enigma.analysis.SourceIndex; |
| 46 | import cuchaz.enigma.analysis.SourceIndexVisitor; | 46 | import cuchaz.enigma.analysis.SourceIndexVisitor; |
| 47 | import cuchaz.enigma.analysis.Token; | 47 | import cuchaz.enigma.analysis.Token; |
| 48 | import cuchaz.enigma.bytecode.ClassProtectifier; | ||
| 48 | import cuchaz.enigma.mapping.ArgumentEntry; | 49 | import cuchaz.enigma.mapping.ArgumentEntry; |
| 49 | import cuchaz.enigma.mapping.BehaviorEntry; | 50 | import cuchaz.enigma.mapping.BehaviorEntry; |
| 50 | import cuchaz.enigma.mapping.ClassEntry; | 51 | import cuchaz.enigma.mapping.ClassEntry; |
| @@ -357,6 +358,37 @@ public class Deobfuscator { | |||
| 357 | } | 358 | } |
| 358 | } | 359 | } |
| 359 | 360 | ||
| 361 | public void protectifyJar(File out, ProgressListener progress) { | ||
| 362 | try (JarOutputStream outJar = new JarOutputStream(new FileOutputStream(out))) { | ||
| 363 | if (progress != null) { | ||
| 364 | progress.init(JarClassIterator.getClassEntries(m_jar).size(), "Protectifying classes..."); | ||
| 365 | } | ||
| 366 | |||
| 367 | int i = 0; | ||
| 368 | for (CtClass c : JarClassIterator.classes(m_jar)) { | ||
| 369 | if (progress != null) { | ||
| 370 | progress.onProgress(i++, c.getName()); | ||
| 371 | } | ||
| 372 | |||
| 373 | try { | ||
| 374 | c = ClassProtectifier.protectify(c); | ||
| 375 | outJar.putNextEntry(new JarEntry(c.getName().replace('.', '/') + ".class")); | ||
| 376 | outJar.write(c.toBytecode()); | ||
| 377 | outJar.closeEntry(); | ||
| 378 | } catch (Throwable t) { | ||
| 379 | throw new Error("Unable to protectify class " + c.getName(), t); | ||
| 380 | } | ||
| 381 | } | ||
| 382 | if (progress != null) { | ||
| 383 | progress.onProgress(i, "Done!"); | ||
| 384 | } | ||
| 385 | |||
| 386 | outJar.close(); | ||
| 387 | } catch (IOException ex) { | ||
| 388 | throw new Error("Unable to write to Jar file!"); | ||
| 389 | } | ||
| 390 | } | ||
| 391 | |||
| 360 | public <T extends Entry> T obfuscateEntry(T deobfEntry) { | 392 | public <T extends Entry> T obfuscateEntry(T deobfEntry) { |
| 361 | if (deobfEntry == null) { | 393 | if (deobfEntry == null) { |
| 362 | return null; | 394 | return null; |