Skip to content

Commit

Permalink
Added GUI & Improves StringEncryption
Browse files Browse the repository at this point in the history
  • Loading branch information
superblaubeere27 committed Jul 10, 2018
1 parent e54c3f1 commit 9946843
Show file tree
Hide file tree
Showing 40 changed files with 1,199 additions and 656 deletions.
7 changes: 6 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,19 @@

<groupId>me.superblaubeere27</groupId>
<artifactId>obfuscator</artifactId>
<version>1.5</version>
<version>1.6</version>

<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm-debug-all</artifactId>
<version>6.0_BETA</version>
</dependency>
<dependency>
<groupId>com.fifesoft</groupId>
<artifactId>rsyntaxtextarea</artifactId>
<version>2.6.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/biz.aQute/bndlib -->

<dependency>
Expand Down
9 changes: 2 additions & 7 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
function isRemappingEnabledForClass(name) {
if (name.toLowerCase().endsWith("main")) {
print("Keeping Main-Class " + name);
return false;
}

return true;
return false;
}
function isObfuscatorEnabledForClass(name) {
return !name.contains("netty");
return true;
}
85 changes: 0 additions & 85 deletions src/main/java/me/superblaubeere27/jobf/Configuration.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
import org.objectweb.asm.tree.ClassNode;

public interface IClassProcessor {
void process(ClassNode node, int mode);
void process(ClassNode node);
}
113 changes: 50 additions & 63 deletions src/main/java/me/superblaubeere27/jobf/JObf.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,53 @@
import me.superblaubeere27.hwid.HWID;
import me.superblaubeere27.jobf.ui.GUI;
import me.superblaubeere27.jobf.util.script.JObfScript;
import me.superblaubeere27.jobf.utils.Templates;

import javax.swing.*;
import java.io.File;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.*;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;

public class JObf {
private static final String VERSION = "Obfuscator v" + (JObf.class.getPackage().getImplementationVersion() == null ? "0.0" : JObf.class.getPackage().getImplementationVersion()) + " by superblaubeere27";
private final static Logger log = Logger.getLogger("Obfuscator");
public static final String VERSION = "obfuscator " + (JObf.class.getPackage().getImplementationVersion() == null ? "DEV" : "v" + JObf.class.getPackage().getImplementationVersion()) + " by superblaubeere27";
public final static Logger log = Logger.getLogger("obfuscator");
private static GUI gui;

public static void main(String[] args) throws Exception {
Class.forName(JObfImpl.class.getCanonicalName());
JObf.log.setUseParentHandlers(false);
JObf.log.setLevel(Level.ALL);
JObf.log.setFilter(record -> true);

// if (log != null) {a

JObf.log.addHandler(new Handler() {
@Override
public void publish(LogRecord record) {
// if (record.getLevel().intValue() < Level.INFO.intValue()) return;
// System.out.println("ACAB");
if (gui != null) {
gui.logArea.append(String.format(record.getMessage(), record.getParameters()) + "\n");
gui.scrollDown();
// System.out.println("lloool");
}

System.out.println(String.format(record.getMessage(), record.getParameters()));
}

@Override
public void flush() {
}

@Override
public void close() throws SecurityException {
}
});
// MethodHandle handle = MethodHandles.lookup().findVirtual(PrintStream.class, "println", MethodType.methodType(void.class, int.class));
// handle.asType(MethodType.methodType(void.class, int.class));
// MethodHandles.lookup().loo
Expand All @@ -31,6 +63,8 @@ public static void main(String[] args) throws Exception {
// throwable.printStackTrace();
// }

Templates.loadTemplates();

OptionParser parser = new OptionParser();
parser.accepts("help").forHelp();
parser.accepts("version").forHelp();
Expand Down Expand Up @@ -63,56 +97,7 @@ public static void main(String[] args) throws Exception {
String log = (String) options.valueOf("log");
int mode = (int) options.valueOf("mode");

JObf.log.setUseParentHandlers(false);
JObf.log.setLevel(Level.ALL);

if (log != null) {
FileHandler filehandler = new FileHandler(log);
filehandler.setFormatter(new Formatter() {
@Override
public synchronized String format(LogRecord record) {
StringBuffer sb = new StringBuffer();
String message = this.formatMessage(record);
sb.append(record.getLevel().getName());
sb.append(": ");
sb.append(message);
sb.append("\n");
if (record.getThrown() != null) {
try {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
record.getThrown().printStackTrace(pw);
pw.close();
sb.append(sw.toString());
} catch (Exception ex) {
}
}
return sb.toString();
}

});
JObf.log.addHandler(filehandler);
}

JObf.log.addHandler(new Handler() {
@Override
public void publish(LogRecord record) {
// if (record.getLevel().intValue() < Level.INFO.intValue()) return;

if (gui != null)
gui.logArea.append(String.format(record.getMessage(), record.getParameters()) + "\n");

System.out.println(String.format(record.getMessage(), record.getParameters()));
}

@Override
public void flush() {
}

@Override
public void close() throws SecurityException {
}
});

log(JObf.VERSION);
log("Input: " + jarIn);
Expand All @@ -130,9 +115,7 @@ public void close() throws SecurityException {
String path = p.toString().toLowerCase();

return path.endsWith(".jar") || path.endsWith(".zip");
}).forEach(p -> {
fileList.add(p.toFile());
});
}).forEach(p -> fileList.add(p.toFile()));
} else if (file.getName().endsWith(".jar") || file.getName().endsWith(".zip")) {
fileList.add(file);
}
Expand All @@ -158,13 +141,13 @@ public void close() throws SecurityException {
System.exit(1);
}
} catch (OptionException e) {
// try {
// UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
// } catch (Exception e1) {
// e1.printStackTrace();
// }
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e1) {
e1.printStackTrace();
}

// gui = new GUI();
gui = new GUI();
// e.printStackTrace();
// parser.printHelpOn(System.out);
System.err.println("ERROR: " + e.getMessage() + " (try --help)");
Expand All @@ -176,4 +159,8 @@ public void close() throws SecurityException {
private static void log(String line) {
log.info(line);
}

public static void report(String s) {

}
}
Loading

0 comments on commit 9946843

Please sign in to comment.