Skip to content

Commit

Permalink
fixed packaging bug and finished jshrink deobfuscator
Browse files Browse the repository at this point in the history
  • Loading branch information
Contra committed Apr 13, 2011
1 parent a0c6e8a commit 887e0e2
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 33 deletions.
75 changes: 46 additions & 29 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified out/artifacts/JMOT_jar/JMOT.jar
Binary file not shown.
Binary file modified out/production/JMOT/net/contra/obfuscator/Application$1.class
Binary file not shown.
Binary file modified out/production/JMOT/net/contra/obfuscator/Application.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Expand Up @@ -137,6 +137,5 @@ public void transform() {
public void save() {
String loc = Location.replace(".jar", Settings.FILE_TAG + ".jar");
LoadedJar.saveJar(loc);

}
}
Expand Up @@ -4,6 +4,7 @@
import com.sun.org.apache.bcel.internal.generic.*;
import net.contra.obfuscator.Application;
import net.contra.obfuscator.ITransformer;
import net.contra.obfuscator.Settings;
import net.contra.obfuscator.util.bcel.BCELMethods;
import net.contra.obfuscator.util.bcel.JarLoader;
import net.contra.obfuscator.util.misc.LogHandler;
Expand Down Expand Up @@ -58,7 +59,8 @@ public void transform() {
if (BCELMethods.isInteger(handle.getInstruction())
&& handle.getNext().getInstruction() instanceof INVOKESTATIC) {
assert shrinkClass != null;
if(!BCELMethods.getInvokeClassName(handle.getNext().getInstruction(), cg.getConstantPool()).equals(shrinkClass.getClassName())) continue;
if (!BCELMethods.getInvokeClassName(handle.getNext().getInstruction(), cg.getConstantPool()).equals(shrinkClass.getClassName()))
continue;
int storeidx = BCELMethods.getIntegerValue(handle.getInstruction());
StoreHandler store = new StoreHandler(LoadedJar);
String orig = store.getString(storeidx);
Expand All @@ -78,6 +80,8 @@ public void transform() {
}

public void save() {
String loc = Location.replace(".jar", Settings.FILE_TAG + ".jar");
LoadedJar.saveJar(loc);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/net/contra/obfuscator/util/bcel/JarLoader.java
Expand Up @@ -25,7 +25,7 @@ public JarLoader(String fileLocation) {
File file = new File(fileLocation);
JarFile jarFile = new JarFile(file);
Enumeration<JarEntry> entries = jarFile.entries();
if(jarFile.getManifest() != null){
if (jarFile.getManifest() != null) {
wipeManifest(jarFile.getManifest().getMainAttributes().getValue("Main-Class"));
}
while (entries.hasMoreElements()) {
Expand Down Expand Up @@ -63,7 +63,7 @@ public void saveJar(String fileName) {
FileOutputStream os = new FileOutputStream(fileName);
JarOutputStream jos = new JarOutputStream(os);
for (ClassGen classIt : ClassEntries.values()) {
jos.putNextEntry(new JarEntry(classIt.getClassName().replace('.', File.separatorChar) + ".class"));
jos.putNextEntry(new JarEntry(classIt.getClassName().replace('.', '/') + ".class"));
jos.write(classIt.getJavaClass().getBytes());
jos.closeEntry();
jos.flush();
Expand Down

0 comments on commit 887e0e2

Please sign in to comment.