2.1.0 Released

11/5/2014 - Started working on the EZ-Inject plugin.
11/6/2014 - Fixed the ClassNodeDecompiler creating unnessessary objects.
(thanks bibl).
11/6/2014 - Finished an alpha version of EZ-Inject.
11/6/2014 - Started working on a basic obfuscator.
11/6/2014 - The Obfuscator now sucessfully renames all field names.
11/6/2014 - Updated CFR to cfr_0_90.
11/8/2014 - Started working on the API for BCV.
11/9/2014 - Decided to make a graphical reflection kit.
11/10/2014 - Made some progress with the obfuscator, almost finished
EZ-Injection.
11/14/2014 - Been doing various updates to EZ-Injection, Obfucsation,
Reflection Kit and the BCV API.
11/16/2014 - Added the option to launch BCV command line as java -jar
bcv.jar C:/test.jar C:/example/whatever.jar
11/17/2014 - Fixed an issue with the out of date checking UI still
activating when not selected.
11/19/2014 - Added annotatitons/local variables to the methodnode
decompiler (Thanks Bibl).
11/21/2014 - Decided to release it with the obfuscator/reflection kit
unfinished, they're currently disabled for future use.
This commit is contained in:
Kalen Kinloch 2014-11-21 14:55:55 -08:00
parent 28a187a7cd
commit d163bd0cf4

AI 샘플 코드 생성 중입니다

Loading...
46 changed files with 1539 additions and 117 deletions

BIN
BytecodeViewer 2.1.0.jar Normal file

Binary file not shown.

View File

@ -34,7 +34,7 @@ Join The Bytecode Club Today!
http://the.bytecode.club
Changelog:
--- Beta 1.0 ---:
--- Beta 1.0.0 ---:
10/4/2014 - Designed a POC GUI, still needs a lot of work.
10/4/2014 - Started importing J-RET's backend.
10/5/2014 - Finished importing J-RET's backend.
@ -93,12 +93,12 @@ Changelog:
10/16/2014 - Now if you try search with an empty string, it won't search.
10/16/2014 - Added Replace Strings plugin.
10/16/2014 - Added a loading icon that displays whenever a background task is being executed.
--- Beta 1.1 ---:
--- Beta 1.1.0 ---:
10/19/2014 - Fixed harcoded \\.
--- Beta 1.2 ---:
--- Beta 1.2.0 ---:
10/19/2014 - Started importing Procyon and CFR decompilers.
10/19/2014 - Partially finished importing Procyon and CFR, just need to finish export java files as zip.
--- Beta 1.3 ---:
--- Beta 1.3.0 ---:
10/22/2014 - Imported Bibl's Bytecode Decompiler from CFIDE.
10/22/2014 - Did some changes to the Bytecode Decompiler.
10/23/2014 - Added CFR settings.
@ -114,13 +114,13 @@ Changelog:
10/29/2014 - Replaced JSyntaxPane with RSyntaxArea, this sadly removes the search feature inside of source/bytecode files, I'll implement a search function soon. (This also fixes the JRE 1.8 issue)
10/29/2014 - Added a new decompiler option to append brackets to labels.
10/31/2014 - Fixed an issue with the decompiler still running when the source code pane isn't toggled.
--- Beta 1.4 ---:
--- Beta 1.4.0 ---:
11/1/2014 - Fixed FernFlower save Java files on Unix.
11/1/2014 - FernFlower now uses the settings for save Java files.
11/1/2014 - Added Procyon save Java files (It uses the settings).
11/1/2014 - Updated CFR to cfr_0_89.
11/1/2014 - Added CFR save Java files (It uses the settings), however it relies on the file system, because of this if there is heavy name obfuscation, it could mess up for windows.
--- Beta 1.5 ---:
--- Beta 1.5.0 ---:
11/1/2014 - Updated and improved the search function, it now prints out more useful information.
11/1/2014 - Fixed a UI issue with the Replace All Strings plugin.
11/2/2014 - Added search function to the Class Viewer.
@ -135,7 +135,7 @@ Changelog:
11/3/2014 - Removed the option to disable syntax highlighting (since it's lightweight now).
11/3/2014 - About window now contains the version number and the BCV directory.
11/3/2014 - Added an option to toggle to outdated status.
--- 2.0 ---: //Out of beta, WOO
--- 2.0.0 ---: //Out of beta, WOO
11/4/2014 - Officially been 1 month of development.
11/4/2014 - Replaced ""+ with String.valueOf (cheers bibl).
11/4/2014 - Changed how the temp directory was created.
@ -150,4 +150,19 @@ Changelog:
11/5/2014 - Added icons to the program (cheers Fluke).
--- 2.0.1 ---:
11/7/2014 - Fixed the search function.
11/7/2014 - Removed an unused package containing some unused classes.
11/7/2014 - Removed an unused package containing some unused classes.
--- 2.1.0 ---:
11/5/2014 - Started working on the EZ-Inject plugin.
11/6/2014 - Fixed the ClassNodeDecompiler creating unnessessary objects. (thanks bibl).
11/6/2014 - Finished an alpha version of EZ-Inject.
11/6/2014 - Started working on a basic obfuscator.
11/6/2014 - The Obfuscator now sucessfully renames all field names.
11/6/2014 - Updated CFR to cfr_0_90.
11/8/2014 - Started working on the API for BCV.
11/9/2014 - Decided to make a graphical reflection kit.
11/10/2014 - Made some progress with the obfuscator, almost finished EZ-Injection.
11/14/2014 - Been doing various updates to EZ-Injection, Obfucsation, Reflection Kit and the BCV API.
11/16/2014 - Added the option to launch BCV command line as java -jar bcv.jar C:/test.jar C:/example/whatever.jar
11/17/2014 - Fixed an issue with the out of date checking UI still activating when not selected.
11/19/2014 - Added annotatitons/local variables to the methodnode decompiler (Thanks Bibl).
11/21/2014 - Decided to release it with the obfuscator/reflection kit unfinished, they're currently disabled for future use.

View File

@ -1 +1 @@
2.0.1
2.1.0

BIN
libs/booster-2.0.1.jar Normal file

Binary file not shown.

BIN
libs/guava-18.0.jar Normal file

Binary file not shown.

BIN
libs/jopt-simple-4.8.jar Normal file

Binary file not shown.

BIN
libs/poa-2.0.1.jar Normal file

Binary file not shown.

BIN
libs/proguard.jar Normal file

Binary file not shown.

View File

@ -1,5 +1,4 @@
import the.bytecode.club.bytecodeviewer.plugins.Plugin;
import the.bytecode.club.bytecodeviewer.plugins.PluginConsole;
import the.bytecode.club.bytecodeviewer.api.*;
import java.util.ArrayList;
import org.objectweb.asm.tree.ClassNode;

View File

@ -1,7 +1,7 @@
require 'java'
java_import 'the.bytecode.club.bytecodeviewer.plugins.Plugin'
java_import 'the.bytecode.club.bytecodeviewer.plugins.PluginConsole'
java_import 'the.bytecode.club.bytecodeviewer.api.Plugin'
java_import 'the.bytecode.club.bytecodeviewer.api.PluginConsole'
java_import 'java.lang.System'
java_import 'java.util.ArrayList'
java_import 'org.objectweb.asm.tree.ClassNode'

View File

@ -1,5 +1,5 @@
from the.bytecode.club.bytecodeviewer.plugins import Plugin
from the.bytecode.club.bytecodeviewer.plugins import PluginConsole
from the.bytecode.club.bytecodeviewer.api import Plugin
from the.bytecode.club.bytecodeviewer.api import PluginConsole
from java.lang import System
from java.lang import Boolean
from java.util import ArrayList

View File

@ -61,6 +61,14 @@ import the.bytecode.club.bytecodeviewer.plugins.PluginManager;
* The import jar method eats up a lot of memory, look into some how reducing this.
* Make the search results clickable
* Add a tool to build a flowchart of all the classes, and what methods execute what classes, and those method, read chatlog
* 2.1:
* Add obfuscation
* Add progress bars on saving all zips/java decompile jar
* Add the jump/save mark system Ida Pro has.
* Add a search function to the plugin console?
* Add integer boxing and other obfuscation methods contra thought of
* Insert unadded/debug opcodes to try to fuck up decompilers
* ClassAnylyzterAdapter
*
* ----Beta 1.0-----:
* 10/4/2014 - Designed a POC GUI, still needs a lot of work.
@ -148,22 +156,22 @@ import the.bytecode.club.bytecodeviewer.plugins.PluginManager;
* 11/1/2014 - Added Procyon save Java files (It uses the settings).
* 11/1/2014 - Updated CFR to cfr_0_89.
* 11/1/2014 - Added CFR save Java files (It uses the settings), however it relies on the file system, because of this if there is heavy name obfuscation, it could mess up for windows.
* ----Beta 1.5-----:
* -----Beta 1.5-----:
* 11/1/2014 - Updated and improved the search function, it now prints out more useful information.
* 11/1/2014 - Fixed a UI issue with the Replace All Strings plugin.
* 11/2/2014 - Added search function to the Class Viewer.
* 11/2/2014 - Updated Procyon to procyon-decompiler-0.5.27.
* ----Beta 1.5.1-----:
* -----Beta 1.5.1-----:
* 11/2/2014 - Fixed a CFR issue with packages.
* ----Beta 1.5.2-----:
* -----Beta 1.5.2-----:
* 11/3/2014 - Fixed Refresh Class.
* ----Beta 1.5.3-----:
* -----Beta 1.5.3-----:
* 11/3/2014 - Settings/Temp file are now in a global directory.
* 11/3/2014 - The GUI setttings now save.
* 11/3/2014 - Removed the option to disable syntax highlighting (since it's lightweight now).
* 11/3/2014 - About window now contains the version number and the BCV directory.
* 11/3/2014 - Added an option to toggle to outdated status.
* ----2.0-----:
* -----2.0-----:
* 11/4/2014 - Officially been 1 month of development.
* 11/4/2014 - Replaced ""+ with String.valueOf (cheers bibl).
* 11/4/2014 - Changed how the temp directory was created.
@ -176,9 +184,24 @@ import the.bytecode.club.bytecodeviewer.plugins.PluginManager;
* 11/5/2014 - Kinda added middle mouse button closes tab (only if you click the exit button).
* 11/5/2014 - Improved the Malicious Code Scanner, also made it instant.
* 11/5/2014 - Added icons to the program (cheers Fluke).
* ----2.0.1-----:
* 11/7/2014 - Fixed the search function.
* 11/7/2014 - Removed an unused package containing some unused classes.
* -----2.0.1-----:
* 11/7/2014 - Fixed the search function.
* 11/7/2014 - Removed an unused package containing some unused classes.
* -----2.1-----:
* 11/5/2014 - Started working on the EZ-Inject plugin.
* 11/6/2014 - Fixed the ClassNodeDecompiler creating unnessessary objects. (thanks bibl).
* 11/6/2014 - Finished an alpha version of EZ-Inject.
* 11/6/2014 - Started working on a basic obfuscator.
* 11/6/2014 - The Obfuscator now sucessfully renames all field names.
* 11/6/2014 - Updated CFR to cfr_0_90.
* 11/8/2014 - Started working on the API for BCV.
* 11/9/2014 - Decided to make a graphical reflection kit.
* 11/10/2014 - Made some progress with the obfuscator, almost finished EZ-Injection.
* 11/14/2014 - Been doing various updates to EZ-Injection, Obfucsation, Reflection Kit and the BCV API.
* 11/16/2014 - Added the option to launch BCV command line as java -jar bcv.jar C:/test.jar C:/example/whatever.jar
* 11/17/2014 - Fixed an issue with the out of date checking UI still activating when not selected.
* 11/19/2014 - Added annotatitons/local variables to the methodnode decompiler (Thanks Bibl).
* 11/21/2014 - Decided to release it with the obfuscator/reflection kit unfinished, they're currently disabled for future use.
*
* @author Konloch
*
@ -198,8 +221,9 @@ public class BytecodeViewer {
public static String tempDirectory = getBCVDirectory() + fs + "bcv_temp" + fs;
private static ArrayList<String> recentFiles = DiskReader.loadArrayList(filesName, false);
private static ArrayList<String> recentPlugins = DiskReader.loadArrayList(pluginsName, false);
public static boolean runningObfuscation = false;
public static String version = "2.0.1";
public static String version = "2.1.0";
public static void main(String[] args) {
iconList = new ArrayList<BufferedImage>();
@ -216,41 +240,42 @@ public class BytecodeViewer {
cleanup();
}
});
Thread versionChecker = new Thread() {
@Override
public void run() {
while(viewer == null)
try {
sleep(50);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
if(viewer.chckbxmntmNewCheckItem_12.isSelected()) {
try {
HttpURLConnection connection = (HttpURLConnection) new URL("https://raw.githubusercontent.com/Konloch/bytecode-viewer/master/VERSION").openConnection();
connection.setUseCaches(false);
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0");
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String version = reader.readLine();
reader.close();
if(!BytecodeViewer.version.equals(version))
showMessage("You're running an outdated version of Bytecode Viewer, current version: " + BytecodeViewer.version + ", latest version: " + version+nl+nl+"https://github.com/Konloch/bytecode-viewer");
} catch(Exception e) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(e);
}
}
}
};
versionChecker.start();
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(e);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
viewer = new MainViewerGUI();
loadGUISettings();
resetRecentFilesMenu();
Thread versionChecker = new Thread() {
@Override
public void run() {
try {
HttpURLConnection connection = (HttpURLConnection) new URL("https://raw.githubusercontent.com/Konloch/bytecode-viewer/master/VERSION").openConnection();
connection.setUseCaches(false);
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0");
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String version = reader.readLine();
reader.close();
if(!BytecodeViewer.version.equals(version))
showMessage("You're running an outdated version of Bytecode Viewer, current version: " + BytecodeViewer.version + ", latest version: " + version+nl+nl+"https://github.com/Konloch/bytecode-viewer");
} catch(Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
}
};
if(viewer.chckbxmntmNewCheckItem_12.isSelected()) //start only if selected
versionChecker.start();
if(args.length >= 1)
for(String s : args) {
openFiles(new File[]{new File(s)});
}
viewer.setVisible(true);
}
@ -260,6 +285,13 @@ public class BytecodeViewer {
return null;
}
public static void updateNode(ClassNode oldNode, ClassNode newNode) {
for(ClassNode c : BytecodeViewer.getLoadedClasses()) {
if(c.name.equals(oldNode.name))
c = newNode;
}
}
public static ArrayList<ClassNode> getLoadedClasses() {
ArrayList<ClassNode> a = new ArrayList<ClassNode>();
if(loadedClasses != null)
@ -281,7 +313,7 @@ public class BytecodeViewer {
try {
JarUtils.put(f, BytecodeViewer.loadedClasses);
} catch (final Exception e) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(e);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
}
@ -290,7 +322,7 @@ public class BytecodeViewer {
final ClassNode cn = JarUtils.getNode(JarUtils.getBytes(new FileInputStream(f)));
BytecodeViewer.loadedClasses.put(cn.name, cn);
} catch (final Exception e) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(e);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
}
}
@ -311,7 +343,7 @@ public class BytecodeViewer {
try {
PluginManager.runPlugin(plugin);
} catch (Exception e) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(e);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
addRecentPlugin(plugin);
}
@ -340,6 +372,7 @@ public class BytecodeViewer {
MainViewerGUI.getComponent(FileNavigationPane.class).resetWorkspace();
MainViewerGUI.getComponent(WorkPane.class).resetWorkspace();
MainViewerGUI.getComponent(SearchingPane.class).resetWorkspace();
the.bytecode.club.bytecodeviewer.api.BytecodeViewer.getClassNodeLoader().clear();
}
}
@ -538,7 +571,7 @@ public class BytecodeViewer {
DiskWriter.writeNewLine(settingsName, String.valueOf(viewer.chckbxmntmNewCheckItem.isSelected()), false);
DiskWriter.writeNewLine(settingsName, String.valueOf(viewer.chckbxmntmNewCheckItem_12.isSelected()), false);
} catch(Exception e) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(e);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
}
@ -659,7 +692,7 @@ public class BytecodeViewer {
image = ImageIO.read(bis);
bis.close();
} catch (Exception e) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(e);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
return image;

View File

@ -357,13 +357,13 @@ public class FileDrop {
} // end try
catch (final java.io.IOException io) {
log(out, "FileDrop: IOException - abort:");
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(io);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(io);
evt.rejectDrop();
} // end catch IOException
catch (final java.awt.datatransfer.UnsupportedFlavorException ufe) {
log(out,
"FileDrop: UnsupportedFlavorException - abort:");
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(ufe);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(ufe);
evt.rejectDrop();
} // end catch: UnsupportedFlavorException
finally {
@ -467,7 +467,7 @@ public class FileDrop {
dt.addDropTargetListener(dropListener);
} // end try
catch (final java.util.TooManyListenersException e) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(e);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
log(out,
"FileDrop: Drop will not work due to previous error. Do you have another listener attached?");
} // end catch

View File

@ -101,7 +101,7 @@ public class JarUtils {
out.close();
} catch (IOException e) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(e);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
}
@ -128,7 +128,7 @@ public class JarUtils {
out.close();
} catch (IOException e) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(e);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
}

View File

@ -0,0 +1,134 @@
package the.bytecode.club.bytecodeviewer;
import java.io.IOException;
import the.bytecode.club.bytecodeviewer.plugins.EZInjection;
public class RuntimeOverride {
private static RuntimeOverride currentRuntime = new RuntimeOverride();
public static RuntimeOverride getRuntime() {
return currentRuntime;
}
public void exit(int status) {
if(EZInjection.sandboxSystem) {
EZInjection.exitR(status);
} else {
Runtime.getRuntime().exit(status);
}
}
public void addShutdownHook(Thread hook) {
Runtime.getRuntime().addShutdownHook(hook);
}
public boolean removeShutdownHook(Thread hook) {
return Runtime.getRuntime().removeShutdownHook(hook);
}
public void halt(int status) {
Runtime.getRuntime().halt(status);
}
public Process exec(String command) throws IOException {
if(EZInjection.sandboxSystem) {
EZInjection.announceSystem(command);
return null;
} else {
return Runtime.getRuntime().exec(command);
}
}
/*public Process exec(String command, String[] envp) throws IOException {
return exec(command, envp, null);
}
public Process exec(String command, String[] envp, File dir)
throws IOException {
if (command.length() == 0)
throw new IllegalArgumentException("Empty command");
StringTokenizer st = new StringTokenizer(command);
String[] cmdarray = new String[st.countTokens()];
for (int i = 0; st.hasMoreTokens(); i++)
cmdarray[i] = st.nextToken();
return exec(cmdarray, envp, dir);
}
public Process exec(String cmdarray[]) throws IOException {
return exec(cmdarray, null, null);
}
public Process exec(String[] cmdarray, String[] envp) throws IOException {
return exec(cmdarray, envp, null);
}
public Process exec(String[] cmdarray, String[] envp, File dir)
throws IOException {
return new ProcessBuilder(cmdarray)
.environment(envp)
.directory(dir)
.start();
}
public native int availableProcessors();
public native long freeMemory();
public native long totalMemory();
public native long maxMemory();
public void gc() {
Runtime.getRuntime().gc();
}
public void runFinalization() {
Runtime.getRuntime().runFinalization();
}
public native void traceInstructions(boolean on);
public native void traceMethodCalls(boolean on);
public void load(String filename) {
load0(Reflection.getCallerClass(), filename);
}
synchronized void load0(Class fromClass, String filename) {
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkLink(filename);
}
if (!(new File(filename).isAbsolute())) {
throw new UnsatisfiedLinkError(
"Expecting an absolute path of the library: " + filename);
}
ClassLoader.loadLibrary(fromClass, filename, true);
}
public void loadLibrary(String libname) {
loadLibrary0(Reflection.getCallerClass(), libname);
}
synchronized void loadLibrary0(Class fromClass, String libname) {
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkLink(libname);
}
if (libname.indexOf((int)File.separatorChar) != -1) {
throw new UnsatisfiedLinkError(
"Directory separator should not appear in library name: " + libname);
}
ClassLoader.loadLibrary(fromClass, libname, false);
}
public InputStream getLocalizedInputStream(InputStream in) {
return in;
}
public OutputStream getLocalizedOutputStream(OutputStream out) {
return out;
}*/
}

View File

@ -0,0 +1,181 @@
package the.bytecode.club.bytecodeviewer.api;
import java.util.List;
import org.objectweb.asm.tree.AbstractInsnNode;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.FieldInsnNode;
import org.objectweb.asm.tree.FieldNode;
import org.objectweb.asm.tree.InnerClassNode;
import org.objectweb.asm.tree.LocalVariableNode;
import org.objectweb.asm.tree.MethodInsnNode;
import org.objectweb.asm.tree.MethodNode;
import org.objectweb.asm.tree.TypeInsnNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
/**
* Used to rename/replace methods/classes/fields
*
* @author Konloch
*
*/
public final class ASMUtil_OLD {
public static void renameFieldNode(String originalParentName, String originalFieldName,
String originalFieldDesc, String newFieldParent, String newFieldName, String newFieldDesc)
{
for(ClassNode c : BytecodeViewer.getLoadedClasses()) {
for(Object o : c.methods.toArray()) {
MethodNode m = (MethodNode)o;
for(AbstractInsnNode i : m.instructions.toArray()) {
if(i instanceof FieldInsnNode) {
FieldInsnNode field = (FieldInsnNode)i;
if(field.owner.equals(originalParentName) &&
field.name.equals(originalFieldName) &&
field.desc.equals(originalFieldDesc))
{
if(newFieldParent != null)
field.owner = newFieldParent;
if(newFieldName != null)
field.name = newFieldName;
if(newFieldDesc != null)
field.desc = newFieldDesc;
}
}
}
}
}
}
public static void renameMethodNode(String originalParentName, String originalMethodName,
String originalMethodDesc, String newParent, String newName, String newDesc)
{
for(ClassNode c : BytecodeViewer.getLoadedClasses()) {
for(Object o : c.methods.toArray()) {
MethodNode m = (MethodNode)o;
for(AbstractInsnNode i : m.instructions.toArray()) {
if(i instanceof MethodInsnNode) {
MethodInsnNode mi = (MethodInsnNode)i;
if(mi.owner.equals(originalParentName) &&
mi.name.equals(originalMethodName) &&
mi.desc.equals(originalMethodDesc))
{
if(newParent != null)
mi.owner = newParent;
if(newName != null)
mi.name = newName;
if(newDesc != null)
mi.desc = newDesc;
}
} else {
//System.out.println(i.getOpcode()+":"+c.name+":"+m.name);
}
}
if(m.signature != null) {
if(newName != null)
m.signature = m.signature.replace(originalMethodName, newName);
if(newParent != null)
m.signature = m.signature.replace(originalParentName, newParent);
}
if( m.name.equals(originalMethodName) &&
m.desc.equals(originalMethodDesc) &&
c.name.equals(originalParentName)) {
if(newName != null)
m.name = newName;
if(newDesc != null)
m.desc = newDesc;
}
}
}
}
@SuppressWarnings("unchecked")
public static void renameClassNode(final String oldName, final String newName) {
for(ClassNode c : BytecodeViewer.getLoadedClasses()) {
for (Object oo : c.innerClasses) {
InnerClassNode innerClassNode = (InnerClassNode) oo;
if (innerClassNode.innerName != null &&
innerClassNode.innerName.equals(oldName)) {
innerClassNode.innerName = newName;
}
if (innerClassNode.name.equals(oldName)) {
innerClassNode.name = newName;
}
if (innerClassNode.outerName != null &&
innerClassNode.outerName.equals(oldName)) {
innerClassNode.outerName = newName;
}
}
if(c.signature != null)
c.signature = c.signature.replace(oldName, newName);
if (c.superName.equals(oldName)) {
c.superName = newName;
}
for(Object o : c.fields.toArray()) {
FieldNode f = (FieldNode)o;
f.desc = f.desc.replace(oldName, newName);
}
for(Object o : c.interfaces.toArray()) {
String truxerLipton = (String)o;
truxerLipton = truxerLipton.replace(oldName, newName);
}
for(Object o : c.methods.toArray()) {
MethodNode m = (MethodNode)o;
if(m.localVariables != null) {
for(LocalVariableNode node : (List<LocalVariableNode>)m.localVariables) {
node.desc = node.desc.replace(oldName, newName);
}
}
if(m.signature != null)
m.signature = m.signature.replace(oldName, newName);
for(int i = 0; i < m.exceptions.size(); i++) {
if(m.exceptions.get(i).equals(oldName))
m.exceptions.set(i, newName);
}
for(AbstractInsnNode i : m.instructions.toArray()) {
if (i instanceof TypeInsnNode) {
TypeInsnNode t = (TypeInsnNode)i;
if (t.desc.equals(oldName)) {
t.desc = newName;
}
}
if(i instanceof MethodInsnNode) {
MethodInsnNode mi = (MethodInsnNode)i;
if(mi.owner.equals(oldName))
mi.owner = newName;
mi.desc = mi.desc.replace(oldName, newName);
}
if(i instanceof FieldInsnNode) {
FieldInsnNode fi = (FieldInsnNode)i;
if(fi.owner.equals(oldName))
fi.owner = newName;
fi.desc = fi.desc.replace(oldName, newName);
}
}
}
}
/*for(ClassNode oldClass : BytecodeViewer.getLoadedClasses()) {
try {
ClassReader cr = new ClassReader(oldClass.name);
ClassWriter cw = new ClassWriter(0);
cr.accept(new ClassVisitor(0) {
@Override
}, ClassReader.EXPAND_FRAMES);
byte[] b = cw.toByteArray();
} catch(Exception e) {
new ExceptionUI(e);
}
}*/
}
}

View File

@ -0,0 +1,20 @@
package the.bytecode.club.bytecodeviewer.api;
/**
* Whenever a function is executed, this class will be executed with the function
* callHook(String);
*
* @author Konloch
*
*/
public abstract class BytecodeHook {
/**
* Called whenever a function is called (And EZ-Injection has been injected).
*
* @param information the full name of the class, method and method description.
*/
public abstract void callHook(String information);
}

View File

@ -0,0 +1,105 @@
package the.bytecode.club.bytecodeviewer.api;
import java.io.File;
import java.util.ArrayList;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.plugins.EZInjection;
/**
* The official API for BCV, this was mainly designed for plugin authors
* and people utilizing EZ-Injection.
*
* @author Konloch
*
*/
public class BytecodeViewer {
/**
* This is used to define a global loader.
*/
private static ClassNodeLoader loader = new ClassNodeLoader();
/**
* Grab the loader instance
* @return
*/
public static ClassNodeLoader getClassNodeLoader() {
return loader;
}
/**
* Creates a new instance of the ClassNode loader.
*/
public static void createNewClassNodeLoaderInstance() {
loader.clear();
loader = new ClassNodeLoader();
}
/**
* Used to start a plugin from file.
* @param plugin the file of the plugin
*/
public static void startPlugin(File plugin) {
the.bytecode.club.bytecodeviewer.BytecodeViewer.startPlugin(plugin);
}
/**
* Used to load classes/jars into BCV.
* @param files an array of the files you want loaded.
*/
public static void openFiles(File[] files) {
the.bytecode.club.bytecodeviewer.BytecodeViewer.openFiles(files);
}
/**
* Used to load a ClassNode.
* @param name the full name of the ClassNode
* @return the ClassNode
*/
public static ClassNode getClassNode(String name) {
return the.bytecode.club.bytecodeviewer.BytecodeViewer.getClassNode(name);
}
/**
* Used to grab the loaded ClassNodes.
* @return the loaded classes
*/
public static ArrayList<ClassNode> getLoadedClasses() {
return the.bytecode.club.bytecodeviewer.BytecodeViewer.getLoadedClasses();
}
/**
* Used to insert a Bytecode Hook using EZ-Injection.
* @param hook
*/
public static void insertHook(BytecodeHook hook) {
EZInjection.hookArray.add(hook);
}
/**
* This will ask the user if they really want to reset the workspace, then
* it'll reset the work space.
*/
public static void resetWorkSpace() {
the.bytecode.club.bytecodeviewer.BytecodeViewer.resetWorkSpace();
}
/**
* If true, it will display the busy icon, if false it will remove it if it's displayed.
* @param busy if it should display the busy icon or not
*/
public static void setBusy(boolean busy) {
the.bytecode.club.bytecodeviewer.BytecodeViewer.viewer.setIcon(busy);
}
/**
* Sends a small window popup with the defined message.
* @param message the message you want to display
*/
public static void showMessage(String message) {
the.bytecode.club.bytecodeviewer.BytecodeViewer.showMessage(message);
}
}

View File

@ -0,0 +1,130 @@
package the.bytecode.club.bytecodeviewer.api;
import java.security.AllPermission;
import java.security.CodeSource;
import java.security.Permissions;
import java.security.ProtectionDomain;
import java.security.cert.Certificate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.tree.ClassNode;
/**
*
* @author Demmonic
*
*/
public final class ClassNodeLoader extends ClassLoader {
private HashMap<String, ClassNode> classes = new HashMap<String, ClassNode>();
/**
* Adds the provided class node to the class loader
* @param name The class name
* @param contents The contents of the class (or data)
*/
public void addClass(ClassNode cn) {
classes.put(cn.name.replace("/", "."), cn);
}
/**
* @param name The name of the class
* @return If this class loader contains the provided class node
*/
public boolean contains(String name) {
return (classes.get(name) != null);
}
/**
* @return All class nodes in this loader
*/
public Collection<ClassNode> getAll() {
return classes.values();
}
/**
* Clears out all class nodes
*/
public void clear() {
classes.clear();
}
/**
* @return All classes in this loader
*/
public Collection<Class<?>> getAllClasses() {
ArrayList<Class<?>> classes = new ArrayList<Class<?>>();
for (String s : this.classes.keySet()) {
try {
classes.add(loadClass(s));
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
return classes;
}
/**
* @param name
* The name of the class
* @return The class node with the provided name
*/
public ClassNode get(String name) {
return classes.get(name);
}
@Override
public Class<?> loadClass(String className) throws ClassNotFoundException {
return findClass(className);
}
@Override
public Class<?> findClass(String name) throws ClassNotFoundException {
if (classes.containsKey(name)) {
return nodeToClass(classes.get(name));
} else {
return super.loadClass(name);
}
}
/**
* Converts a class node to a class
* @param node The node to convert
* @return The converted class
*/
public Class<?> nodeToClass(ClassNode node) {
if (super.findLoadedClass(node.name.replace("/", ".")) != null)
return findLoadedClass(node.name.replace("/", "."));
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
try {
node.accept(cw);
} catch (Exception e) {
e.printStackTrace();
}
byte[] b = cw.toByteArray();
return defineClass(node.name.replaceAll("/", "."), b, 0, b.length, getDomain());
}
/**
* @return This class loader's protection domain
*/
private ProtectionDomain getDomain() {
CodeSource code = new CodeSource(null, (Certificate[]) null);
return new ProtectionDomain(code, getPermissions());
}
/**
* @return This class loader's permissions
*/
private Permissions getPermissions() {
Permissions permissions = new Permissions();
permissions.add(new AllPermission());
return permissions;
}
}

View File

@ -1,4 +1,4 @@
package the.bytecode.club.bytecodeviewer.gui;
package the.bytecode.club.bytecodeviewer.api;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
@ -14,12 +14,35 @@ import java.awt.Color;
import java.io.PrintWriter;
import java.io.StringWriter;
public class StackTraceUI extends JFrame {
/**
* A simple class designed to show exceptions in the UI.
*
* @author Konloch
*
*/
public class ExceptionUI extends JFrame {
/**
* @param e The exception to be shown
*/
public ExceptionUI(Exception e) {
setup(e,"@Konloch");
}
public StackTraceUI(Exception e) {
/**
* @param e The exception to be shown
* @param author the author of the plugin throwing this exception.
*/
public ExceptionUI(Exception e, String author) {
setup(e,author);
}
private void setup(Exception e, String author) {
this.setIconImages(BytecodeViewer.iconList);
setSize(new Dimension(600, 400));
setTitle("Bytecode Viewer "+BytecodeViewer.version+" - Stack Trace - Send this to @Konloch.");
setTitle("Bytecode Viewer "+BytecodeViewer.version+" - Stack Trace - Send this to "+author);
getContentPane().setLayout(new CardLayout(0, 0));
JTextArea txtrBytecodeViewerIs = new JTextArea();

View File

@ -1,4 +1,4 @@
package the.bytecode.club.bytecodeviewer.plugins;
package the.bytecode.club.bytecodeviewer.api;
import java.util.ArrayList;
@ -26,14 +26,36 @@ public abstract class Plugin extends Thread {
BytecodeViewer.showMessage("Plugin not ran, put some classes in first.");
}
} catch(Exception e) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(e);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
} finally {
finished = true;
BytecodeViewer.viewer.setIcon(false);
}
}
public boolean finished = false;
private boolean finished = false;
/**
* When the plugin is finally finished, this will return true
* @return true if the plugin is finished executing
*/
public boolean isFinished() {
return finished;
}
/**
* If for some reason your plugin needs to keep the thread alive,
* yet will still be considered finished (EZ-Injection), you can call this
* function and it will set the finished boolean to true.
*/
public void setFinished() {
finished = true;
}
/**
* Whenever the plugin is started, this method is called
* @param classNodeList all of the loaded classes for easy access.
*/
public abstract void execute(ArrayList<ClassNode> classNodeList);
}

View File

@ -1,4 +1,4 @@
package the.bytecode.club.bytecodeviewer.plugins;
package the.bytecode.club.bytecodeviewer.api;
import javax.swing.JFrame;
@ -20,6 +20,7 @@ import the.bytecode.club.bytecodeviewer.BytecodeViewer;
*/
public class PluginConsole extends JFrame {
JTextArea textArea = new JTextArea();
public PluginConsole(String pluginName) {
this.setIconImages(BytecodeViewer.iconList);
@ -32,11 +33,24 @@ public class PluginConsole extends JFrame {
scrollPane.setViewportView(textArea);
this.setLocationRelativeTo(null);
}
/**
* Appends \r\n to the end of your string, then it puts it on the top.
* @param t the string you want to append
*/
public void appendText(String t) {
textArea.setText((textArea.getText().isEmpty() ? "" : textArea.getText()+"\r\n")+t);
textArea.setCaretPosition(0);
}
/**
* Sets the text
* @param t the text you want set
*/
public void setText(String t) {
textArea.setText(t);
textArea.setCaretPosition(0);
}
private static final long serialVersionUID = -6556940545421437508L;

View File

@ -32,7 +32,8 @@ public class ClassNodeDecompiler {
sb.append(" ");
sb.append(cn.name);
if (cn.superName != null && !cn.superName.equals("java/lang/Object")) {
sb.append(" extends " + cn.superName);
sb.append(" extends ");
sb.append(cn.superName);
}
int amountOfInterfaces = cn.interfaces.size();
@ -47,9 +48,11 @@ public class ClassNodeDecompiler {
sb.append(cn.interfaces.get(i));
}
}
sb.append(" {"+BytecodeViewer.nl);
sb.append(" {");
sb.append(BytecodeViewer.nl);
for (FieldNode fn : (List<FieldNode>)cn.fields) {
sb.append(BytecodeViewer.nl+" ");
sb.append(BytecodeViewer.nl);
sb.append(" ");
FieldNodeDecompiler.decompile(sb, fn);
}
if (cn.fields.size() > 0) {
@ -80,8 +83,10 @@ public class ClassNodeDecompiler {
if(!unableToDecompile.isEmpty()) {
sb.append("//the following inner classes couldn't be decompiled: ");
for(String s : unableToDecompile)
sb.append(s + " ");
for(String s : unableToDecompile) {
sb.append(s);
sb.append(" ");
}
sb.append(BytecodeViewer.nl);
}

View File

@ -218,7 +218,7 @@ public class InstructionPrinter {
try {
return nameOpcode(tin.getOpcode()) + " " + Type.getType(tin.desc).getClassName();
} catch(Exception e) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(e);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
return "//error";
}
@ -267,25 +267,6 @@ public class InstructionPrinter {
}
}
/**
* Creates the print
* @return The print as a string array
*/
public String[] getLines() {
ArrayList<String> lines = createPrint();
return lines.toArray(new String[lines.size()]);
}
/**
* Static method to print
* @param lines To print
*/
public static void consolePrint(String[] lines) {
for(String line : lines) {
System.out.println(line);
}
}
public static void saveTo(File file, InstructionPrinter printer) {
try {
BufferedWriter bw = new BufferedWriter(new FileWriter(file));
@ -295,7 +276,7 @@ public class InstructionPrinter {
}
bw.close();
} catch (IOException e) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(e);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
}
}

View File

@ -1,11 +1,14 @@
package the.bytecode.club.bytecodeviewer.decompilers.bytecode;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.AnnotationNode;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.LocalVariableNode;
import org.objectweb.asm.tree.MethodNode;
import org.objectweb.asm.tree.TryCatchBlockNode;
@ -95,8 +98,23 @@ public class MethodNodeDecompiler {
}
sb.append(BytecodeViewer.nl);
if (m.signature != null) {
sb.append(" <sig:").append(m.signature).append(">");
}
InstructionPrinter insnPrinter = new InstructionPrinter(m, args);
addAttrList(m.attrs, "attr", sb, insnPrinter);
addAttrList(m.invisibleAnnotations, "invisAnno", sb, insnPrinter);
addAttrList(m.invisibleAnnotations, "invisLocalVarAnno", sb, insnPrinter);
addAttrList(m.invisibleTypeAnnotations, "invisTypeAnno", sb, insnPrinter);
addAttrList(m.localVariables, "localVar", sb, insnPrinter);
addAttrList(m.visibleAnnotations, "visAnno", sb, insnPrinter);
addAttrList(m.visibleLocalVariableAnnotations, "visLocalVarAnno", sb, insnPrinter);
addAttrList(m.visibleTypeAnnotations, "visTypeAnno", sb, insnPrinter);
for (Object o : m.tryCatchBlocks) {
TryCatchBlockNode tcbn = (TryCatchBlockNode) o;
sb.append(" ");
@ -122,6 +140,44 @@ public class MethodNodeDecompiler {
}
return sb;
}
private static void addAttrList(List<?> list, String name, PrefixedStringBuilder sb, InstructionPrinter insnPrinter) {
if (list == null)
return;
if (list.size() > 0) {
for (Object o : list) {
sb.append(" <");
sb.append(name);
sb.append(":");
sb.append(printAttr(o, insnPrinter));
sb.append(">");
sb.append("\n");
}
sb.append("\n");
}
}
private static String printAttr(Object o, InstructionPrinter insnPrinter) {
if (o instanceof LocalVariableNode) {
LocalVariableNode lvn = (LocalVariableNode) o;
return "index=" + lvn.index + " , name=" + lvn.name + " , desc=" + lvn.desc + ", sig=" + lvn.signature + ", start=L" + insnPrinter.resolveLabel(lvn.start) + ", end=L" + insnPrinter.resolveLabel(lvn.end);
} else if (o instanceof AnnotationNode) {
AnnotationNode an = (AnnotationNode) o;
StringBuilder sb = new StringBuilder();
sb.append("desc = ");
sb.append(an.desc);
sb.append(" , values = ");
if (an.values != null) {
sb.append(Arrays.toString(an.values.toArray()));
} else {
sb.append("[]");
}
return sb.toString();
}
if (o == null)
return "";
return o.toString();
}
private static String getAccessString(int access) {
// public, protected, private, abstract, static,

View File

@ -46,7 +46,7 @@ public class CFRDecompiler extends JavaDecompiler {
fos.close();
} catch (final IOException e) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(e);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
String fuckery = fuckery(fileStart);
@ -81,7 +81,7 @@ public class CFRDecompiler extends JavaDecompiler {
try {
s = DiskReader.loadAsString(f.getAbsolutePath());
} catch(Exception e) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(e);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
return "CFR error! Send the stacktrace to Konloch at http://the.bytecode.club or konloch@gmail.com";
}
return s;
@ -205,7 +205,7 @@ public class CFRDecompiler extends JavaDecompiler {
try {
zip(fuck, new File(zipName));
} catch (IOException e) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(e);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
fuck.delete();

View File

@ -59,7 +59,7 @@ public class FernFlowerDecompiler extends JavaDecompiler {
fos.close();
} catch (final IOException e) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(e);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler.main(generateMainMethod(tempClass.getAbsolutePath(), "."));
@ -76,7 +76,7 @@ public class FernFlowerDecompiler extends JavaDecompiler {
return s;
} catch (Exception e) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(e);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
}
return "FernFlower error! Send the stacktrace to Konloch at http://the.bytecode.club or konloch@gmail.com";

View File

@ -84,7 +84,7 @@ public class ProcyonDecompiler extends JavaDecompiler {
fos.close();
} catch (final IOException e) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(e);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
@ -109,7 +109,7 @@ public class ProcyonDecompiler extends JavaDecompiler {
return decompiledSource;
} catch(Exception e) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(e);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
return "Procyon error! Send the stacktrace to Konloch at http://the.bytecode.club or konloch@gmail.com";
}
@ -125,7 +125,7 @@ public class ProcyonDecompiler extends JavaDecompiler {
try {
doSaveJarDecompiled(tempZip, new File(zipName));
} catch (Exception e) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(e);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
}

View File

@ -211,7 +211,7 @@ public class ClassViewer extends JPanel {
}
}
} catch(Exception e) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(e);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
}
@ -242,7 +242,7 @@ public class ClassViewer extends JPanel {
pos += pattern.length();
}
} catch (Exception e) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(e);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
}

View File

@ -0,0 +1,138 @@
package the.bytecode.club.bytecodeviewer.gui;
import javax.swing.JFrame;
import java.awt.Dimension;
import javax.swing.JCheckBox;
import javax.swing.JButton;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.plugins.EZInjection;
import the.bytecode.club.bytecodeviewer.plugins.PluginManager;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JTextField;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.MethodNode;
import javax.swing.JLabel;
public class EZInjectionOptions extends JFrame {
public EZInjectionOptions() {
this.setIconImages(BytecodeViewer.iconList);
setSize(new Dimension(250, 454));
setResizable(false);
setTitle("EZ Injection Options");
getContentPane().setLayout(null);
final JCheckBox accessModifiers = new JCheckBox("Change Access Modifiers");
accessModifiers.setSelected(true);
accessModifiers.setBounds(6, 7, 232, 23);
getContentPane().add(accessModifiers);
final JCheckBox invokeMethod = new JCheckBox("Invoke Main Method:");
invokeMethod.setSelected(true);
invokeMethod.setBounds(6, 251, 232, 23);
getContentPane().add(invokeMethod);
final JCheckBox injectHooks = new JCheckBox("Inject Hooks");
injectHooks.setSelected(true);
injectHooks.setBounds(6, 33, 232, 23);
getContentPane().add(injectHooks);
debugMethodCalls = new JCheckBox("Debug Method Calls");
debugMethodCalls.setSelected(true);
debugMethodCalls.setBounds(6, 59, 232, 23);
getContentPane().add(debugMethodCalls);
final JCheckBox runtime = new JCheckBox("Sandbox Runtime.exec");
runtime.setEnabled(false);
runtime.setSelected(true);
runtime.setBounds(6, 138, 232, 23);
getContentPane().add(runtime);
final JCheckBox system = new JCheckBox("Sandbox System.exit");
system.setEnabled(false);
system.setSelected(true);
system.setBounds(6, 164, 232, 23);
getContentPane().add(system);
txtThebytecodeclubexamplemainlstring = new JTextField();
JButton btnNewButton = new JButton("Execute");
btnNewButton.setBounds(6, 393, 232, 23);
getContentPane().add(btnNewButton);
boolean b = false;
for(ClassNode classNode : BytecodeViewer.getLoadedClasses()) {
for(Object o : classNode.methods.toArray()) {
MethodNode m = (MethodNode) o;
if(m.name.equals("main") && m.desc.equals("([Ljava/lang/String;)V")) {
if(!b) {
b = true;
txtThebytecodeclubexamplemainlstring.setText(classNode.name+"."+m.name);
}
}
}
}
if(!b)
txtThebytecodeclubexamplemainlstring.setText("the/bytecode/club/Example.main");
txtThebytecodeclubexamplemainlstring.setBounds(6, 281, 232, 20);
getContentPane().add(txtThebytecodeclubexamplemainlstring);
txtThebytecodeclubexamplemainlstring.setColumns(10);
JLabel lblNewLabel = new JLabel("Debug Classes (Seperate with , ):");
lblNewLabel.setBounds(10, 89, 228, 14);
getContentPane().add(lblNewLabel);
textField = new JTextField();
textField.setText("*");
textField.setBounds(6, 111, 232, 20);
getContentPane().add(textField);
textField.setColumns(10);
textField_1 = new JTextField();
textField_1.setText("127.0.0.1:9050");
textField_1.setColumns(10);
textField_1.setBounds(6, 220, 232, 20);
getContentPane().add(textField_1);
final JCheckBox forceProxy = new JCheckBox("Force Proxy (socks5, host:port):");
forceProxy.setBounds(6, 190, 232, 23);
getContentPane().add(forceProxy);
final JCheckBox launchReflectionKit = new JCheckBox("Launch Reflection Kit On Successful Invoke");
launchReflectionKit.setEnabled(false);
launchReflectionKit.setBounds(6, 308, 232, 23);
getContentPane().add(launchReflectionKit);
final JCheckBox console = new JCheckBox("Launch Console");
console.setBounds(6, 334, 232, 23);
console.setSelected(true);
getContentPane().add(console);
final JCheckBox chckbxPrintToTerminal = new JCheckBox("Print To Command Line");
chckbxPrintToTerminal.setSelected(true);
chckbxPrintToTerminal.setBounds(6, 363, 232, 23);
getContentPane().add(chckbxPrintToTerminal);
this.setLocationRelativeTo(null);
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
PluginManager.runPlugin(new EZInjection(accessModifiers.isSelected(), injectHooks.isSelected(), debugMethodCalls.isSelected(), invokeMethod.isSelected(), txtThebytecodeclubexamplemainlstring.getText(), runtime.isSelected(), system.isSelected(), textField.getText(), textField_1.getText(), forceProxy.isSelected(), launchReflectionKit.isSelected(), console.isSelected(), chckbxPrintToTerminal.isSelected()));
dispose();
}
});
}
private static final long serialVersionUID = -2662514582647810868L;
private JTextField txtThebytecodeclubexamplemainlstring;
private JCheckBox debugMethodCalls;
private JTextField textField;
private JTextField textField_1;
}

View File

@ -0,0 +1,36 @@
package the.bytecode.club.bytecodeviewer.gui;
import javax.swing.JFrame;
import java.awt.Dimension;
import javax.swing.JTabbedPane;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
public class GraphicialReflectionKit extends JFrame {
public GraphicialReflectionKit() {
this.setIconImages(BytecodeViewer.iconList);
setSize(new Dimension(382, 356));
setTitle("Graphicial Reflection Kit");
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
getContentPane().add(tabbedPane, BorderLayout.CENTER);
JPanel panel = new JPanel();
tabbedPane.addTab("Invoke Method", null, panel, null);
JPanel panel_1 = new JPanel();
tabbedPane.addTab("Get Field Value", null, panel_1, null);
JPanel panel_2 = new JPanel();
tabbedPane.addTab("Cast Field", null, panel_2, null);
}
private static final long serialVersionUID = 6728356108271228236L;
}

View File

@ -29,6 +29,9 @@ import the.bytecode.club.bytecodeviewer.JarUtils;
import the.bytecode.club.bytecodeviewer.decompilers.java.CFRDecompiler;
import the.bytecode.club.bytecodeviewer.decompilers.java.FernFlowerDecompiler;
import the.bytecode.club.bytecodeviewer.decompilers.java.ProcyonDecompiler;
import the.bytecode.club.bytecodeviewer.obfuscators.RenameClasses;
import the.bytecode.club.bytecodeviewer.obfuscators.RenameFields;
import the.bytecode.club.bytecodeviewer.obfuscators.RenameMethods;
import the.bytecode.club.bytecodeviewer.plugins.AllatoriStringDecrypter;
import the.bytecode.club.bytecodeviewer.plugins.PluginManager;
import the.bytecode.club.bytecodeviewer.plugins.ShowAllStrings;
@ -163,6 +166,18 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_11 = new JCheckBoxMenuItem("Exclude Nested Types");
public final JCheckBoxMenuItem chckbxmntmAppendBrackets = new JCheckBoxMenuItem("Append Brackets To Labels");
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_12 = new JCheckBoxMenuItem("Update Check");
private final JMenuItem mntmNewMenuItem_5 = new JMenuItem("EZ Inject");
private final JMenu mnNewMenu_5 = new JMenu("Obfuscate");
private final JMenuItem mntmNewMenuItem_6 = new JMenuItem("Rename Fields");
private final JMenuItem mntmNewMenuItem_7 = new JMenuItem("Rename Methods");
private final JMenuItem mntmNewMenuItem_8 = new JMenuItem("Move All Classes Into Root Package");
private final JMenuItem mntmNewMenuItem_9 = new JMenuItem("Control Flow");
private final JMenuItem mntmNewMenuItem_10 = new JMenuItem("Junk Code");
public final ButtonGroup obfuscatorGroup = new ButtonGroup();
public final JRadioButtonMenuItem strongObf = new JRadioButtonMenuItem("Strong Obfuscation");
public final JRadioButtonMenuItem lightObf = new JRadioButtonMenuItem("Light Obfuscation");
private final JMenuItem mntmNewMenuItem_11 = new JMenuItem("Rename Classes");
private final JSeparator separator_2 = new JSeparator();
public void setC(boolean busy) {
if(busy) {
@ -222,6 +237,9 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
decompilerGroup.add(procyonDec);
decompilerGroup.add(cfrDec);
decompilerGroup.setSelected(procyonDec.getModel(), true);
obfuscatorGroup.add(strongObf);
obfuscatorGroup.add(lightObf);
obfuscatorGroup.setSelected(strongObf.getModel(), true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//fernflower
rbr.setSelected(true);
@ -315,7 +333,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
BytecodeViewer.openFiles(new File[]{fc.getSelectedFile()});
BytecodeViewer.viewer.setC(false);
} catch (Exception e1) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(e1);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e1);
}
}
});
@ -598,6 +616,57 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
mnBytecodeDecompilerSettings.add(chckbxmntmAppendBrackets);
mnBytecodeDecompilerSettings.add(chckbxmntmNewCheckItem);
mnNewMenu_5.setVisible(false);
menuBar.add(mnNewMenu_5);
mntmNewMenuItem_6.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
if(BytecodeViewer.runningObfuscation) {
BytecodeViewer.showMessage("You're currently running an obfuscation task, wait for this to finish.");
return;
}
new RenameFields().start();
}
});
mnNewMenu_5.add(strongObf);
mnNewMenu_5.add(lightObf);
mnNewMenu_5.add(separator_2);
mntmNewMenuItem_8.setEnabled(false);
mnNewMenu_5.add(mntmNewMenuItem_8);
mnNewMenu_5.add(mntmNewMenuItem_6);
mntmNewMenuItem_7.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
if(BytecodeViewer.runningObfuscation) {
BytecodeViewer.showMessage("You're currently running an obfuscation task, wait for this to finish.");
return;
}
new RenameMethods().start();
}
});
mnNewMenu_5.add(mntmNewMenuItem_7);
mntmNewMenuItem_11.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
if(BytecodeViewer.runningObfuscation) {
BytecodeViewer.showMessage("You're currently running an obfuscation task, wait for this to finish.");
return;
}
new RenameClasses().start();
}
});
mnNewMenu_5.add(mntmNewMenuItem_11);
mntmNewMenuItem_9.setEnabled(false);
mnNewMenu_5.add(mntmNewMenuItem_9);
mntmNewMenuItem_10.setEnabled(false);
mnNewMenu_5.add(mntmNewMenuItem_10);
menuBar.add(mnNewMenu_1);
mnNewMenu_1.add(mntmStartExternalPlugin);
@ -621,6 +690,18 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
mnNewMenu_1.add(mntmReplaceStrings);
mnNewMenu_1.add(mntmNewMenuItem_2);
mnNewMenu_1.add(mntmStartZkmString);
mntmNewMenuItem_5.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
if(!BytecodeViewer.loadedClasses.isEmpty())
new EZInjectionOptions().setVisible(true);
else {
System.out.println("Plugin not ran, put some classes in first.");
BytecodeViewer.showMessage("Plugin not ran, put some classes in first.");
}
}
});
mnNewMenu_1.add(mntmNewMenuItem_5);
menuBar.add(mntmNewMenuItem_4);
@ -639,7 +720,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
BytecodeViewer.startPlugin(fc.getSelectedFile());
BytecodeViewer.viewer.setC(false);
} catch (Exception e1) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(e1);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e1);
}
}
});

View File

@ -0,0 +1,61 @@
package the.bytecode.club.bytecodeviewer.obfuscators;
import java.util.ArrayList;
import java.util.Random;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
public abstract class JavaObfuscator extends Thread {
@Override
public void run() {
BytecodeViewer.viewer.setIcon(true);
BytecodeViewer.runningObfuscation = true;
obfuscate();
BytecodeViewer.runningObfuscation = false;
BytecodeViewer.viewer.setIcon(false);
}
public int getStringLength() {
if(BytecodeViewer.viewer.obfuscatorGroup.isSelected(BytecodeViewer.viewer.strongObf.getModel())) {
return MAX_STRING_LENGTH;
} else { //if(BytecodeViewer.viewer.obfuscatorGroup.isSelected(BytecodeViewer.viewer.lightObf.getModel())) {
return MIN_STRING_LENGTH;
}
}
public static int MAX_STRING_LENGTH = 250;
public static int MIN_STRING_LENGTH = 20;
private ArrayList<String> names = new ArrayList<String>();
private static final String AB = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
private static final String AN = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
private static Random rnd = new Random();
private static String randomString(int len) {
StringBuilder sb = new StringBuilder(len);
for( int i = 0; i < len; i++ )
sb.append( AB.charAt( rnd.nextInt(AB.length()) ) );
return sb.toString();
}
private static String randomStringNum(int len) {
StringBuilder sb = new StringBuilder(len);
for( int i = 0; i < len; i++ )
sb.append( AN.charAt( rnd.nextInt(AN.length()) ) );
return sb.toString();
}
protected String generateUniqueName(int length) {
boolean found = false;
String name = "";
while(!found) {
String nameTry = randomString(1) + randomStringNum(length-1);
if(!names.contains(nameTry)) {
names.add(nameTry);
name = nameTry;
found = true;
}
}
return name;
}
public abstract void obfuscate();
}

View File

@ -0,0 +1,24 @@
package the.bytecode.club.bytecodeviewer.obfuscators;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.api.ASMUtil_OLD;
public class RenameClasses extends JavaObfuscator {
@Override
public void obfuscate() {
int stringLength = getStringLength();
System.out.println("Obfuscating");
for(ClassNode c : BytecodeViewer.getLoadedClasses()) {
String newName = generateUniqueName(stringLength);
ASMUtil_OLD.renameClassNode(c.name, newName);
c.name = newName;
}
System.out.println("Obfuscated");
}
}

View File

@ -0,0 +1,28 @@
package the.bytecode.club.bytecodeviewer.obfuscators;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.FieldNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.api.ASMUtil_OLD;
public class RenameFields extends JavaObfuscator {
@Override
public void obfuscate() {
int stringLength = getStringLength();
System.out.println("Obfuscating");
for(ClassNode c : BytecodeViewer.getLoadedClasses()) {
for(Object o : c.fields.toArray()) {
FieldNode f = (FieldNode)o;
String newName = generateUniqueName(stringLength);
ASMUtil_OLD.renameFieldNode(c.name,f.name,f.desc, null, newName, null);
f.name = newName;
}
}
System.out.println("Obfuscated");
}
}

View File

@ -0,0 +1,43 @@
package the.bytecode.club.bytecodeviewer.obfuscators;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.MethodNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.api.ASMUtil_OLD;
public class RenameMethods extends JavaObfuscator {
@Override
public void obfuscate() {
int stringLength = getStringLength();
System.out.println("Obfuscating");
for(ClassNode c : BytecodeViewer.getLoadedClasses()) {
for(Object o : c.methods.toArray()) {
MethodNode m = (MethodNode)o;
if( m.access != Opcodes.ACC_ABSTRACT &&
m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_STATIC &&
m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_STATIC + Opcodes.ACC_PUBLIC &&
m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_STATIC + Opcodes.ACC_PRIVATE &&
m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_STATIC + Opcodes.ACC_PROTECTED &&
m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_PUBLIC &&
m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_PRIVATE &&
m.access != Opcodes.ACC_ABSTRACT + Opcodes.ACC_PROTECTED)
{
if(!m.name.equals("main") &&
!m.name.equals("<init>") &&
!m.name.equals("<clinit>"))
{
String newName = generateUniqueName(stringLength);
ASMUtil_OLD.renameMethodNode(c.name,m.name,m.desc,null,newName,null);
}
}
}
}
System.out.println("Obfuscated");
}
}

View File

@ -5,6 +5,7 @@ import java.util.ArrayList;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.api.Plugin;
/**
* Coming soon.

View File

@ -0,0 +1,280 @@
package the.bytecode.club.bytecodeviewer.plugins;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.reflect.Method;
import java.util.ArrayList;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.FieldNode;
import org.objectweb.asm.tree.LdcInsnNode;
import org.objectweb.asm.tree.MethodInsnNode;
import org.objectweb.asm.tree.MethodNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.api.ASMUtil_OLD;
import the.bytecode.club.bytecodeviewer.api.BytecodeHook;
import the.bytecode.club.bytecodeviewer.api.Plugin;
import the.bytecode.club.bytecodeviewer.api.PluginConsole;
import the.bytecode.club.bytecodeviewer.gui.GraphicialReflectionKit;
/**
* EZ Injection - This plugin is designed to provide a graphical way for the user to
* easily change the access modifiers of all fields/methods, insert hooks into all
* functions, and invoke the main function. It also contains an option to launch the
* graphical reflection kit, which is pretty much a GUI for reflection.
*
* @author Konloch
*
* TODO:
* figure out a way to block runtime.exec without java agents, maybe by replacing the method call?
*
*/
public class EZInjection extends Plugin {
public static ArrayList<BytecodeHook> hookArray = new ArrayList<BytecodeHook>();
private static String version = "1.0";
private static PluginConsole gui = new PluginConsole("EZ Injection v"+version);
private boolean
accessModifiers,
injectHooks,
invokeMethod,
useProxy,
launchKit,
console;
public static boolean
sandboxSystem,
sandboxRuntime,
printCmdL;
private static boolean
debugHooks,
all = false;
private String
invokeMethodInformation,
proxy;
private static String[] debugClasses;
public EZInjection(boolean accessModifiers, boolean injectHooks, boolean debugHooks,
boolean invokeMethod, String invokeMethodInformation, boolean sandboxRuntime,
boolean sandboxSystem, String debugClasses, String proxy, boolean useProxy,
boolean launchKit, boolean console, boolean printCmdL) {
the.bytecode.club.bytecodeviewer.api.BytecodeViewer.createNewClassNodeLoaderInstance();
this.accessModifiers = accessModifiers;
this.injectHooks = injectHooks;
EZInjection.debugHooks = debugHooks;
this.invokeMethod = invokeMethod;
this.invokeMethodInformation = invokeMethodInformation+"([Ljava/lang/String;)V";
EZInjection.sandboxRuntime = sandboxRuntime;
EZInjection.sandboxSystem = sandboxSystem;
if(debugClasses.equals("*"))
EZInjection.all = true;
else
EZInjection.debugClasses = debugClasses.split(",");
this.proxy = proxy;
this.useProxy = useProxy;
this.launchKit = launchKit;
this.console = console;
EZInjection.printCmdL = printCmdL;
}
public static void setProxy(String host, String port) {
System.setProperty("java.net.useSystemProxies", "true");
System.setProperty("socksProxyHost", host);
System.setProperty("socksProxyPort", port);
}
private static String lastMessage = "";
public static void hook(String info) {
for(BytecodeHook hook : hookArray)
hook.callHook(info);
if(debugHooks) {
if(lastMessage.equals(info)) //just a small anti spam measurement
return;
lastMessage = info;
boolean print = all;
if(!all && debugClasses.length >= 1) {
for(String s : debugClasses) {
if(info.split("\\.")[0].equals(s.replaceAll("\\.", "/")))
print = true;
}
}
if(print)
print("Method call: "+info);
}
}
public static void print(String message) {
if(printCmdL)
System.out.println(message);
if(gui.isVisible())
gui.appendText(message);
}
public static void exit(int i) {
print("[SANDBOX] Tried to call on System.exit("+i+"), it's been blocked.");
}
public static void exitR(int i) {
print("[SANDBOX] Tried to call on Runtime.exit("+i+"), it's been blocked.");
}
public static void announceSystem(String s) {
print("[SANDBOX] Tried to call on Runtime.exec("+s+"), it's been blocked.");
}
@SuppressWarnings("deprecation")
@Override
public void execute(ArrayList<ClassNode> classNodeList) {
BytecodeViewer.viewer.setIcon(true);
gui.setText("");
if(console)
gui.setVisible(true);
if(accessModifiers)
print("Setting all of the access modifiers to public/public static.");
if(injectHooks)
print("Injecting hook...");
if(debugHooks)
print("Hooks are debugging.");
else if(injectHooks)
print("Hooks are not debugging.");
else
print("Hooks are disabled completely.");
if(sandboxRuntime || sandboxSystem)
print("Sandboxing runtime: " + sandboxRuntime+", system: " +sandboxSystem+".");
else
print("WARNING: Sandboxing is disabled, this is NOT SAFE!");
if(useProxy)
print("Forcing proxy as '" + proxy +"'.");
if(launchKit)
print("Launching the Graphicial Reflection Kit upon a succcessful invoke of the main method.");
for(ClassNode classNode : classNodeList) {
for(Object o : classNode.fields.toArray()) {
FieldNode f = (FieldNode) o;
if(accessModifiers) {
if(f.access == Opcodes.ACC_PRIVATE || f.access == Opcodes.ACC_PROTECTED)
f.access = Opcodes.ACC_PUBLIC;
if(f.access == Opcodes.ACC_PRIVATE + Opcodes.ACC_STATIC || f.access == Opcodes.ACC_PROTECTED + Opcodes.ACC_STATIC)
f.access = Opcodes.ACC_PUBLIC + Opcodes.ACC_STATIC;
if(f.access == Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL || f.access == Opcodes.ACC_PROTECTED + Opcodes.ACC_FINAL)
f.access = Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL;
if(f.access == Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL + Opcodes.ACC_STATIC || f.access == Opcodes.ACC_PROTECTED + Opcodes.ACC_FINAL + Opcodes.ACC_STATIC)
f.access = Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_STATIC;
}
}
for(Object o : classNode.methods.toArray()) {
MethodNode m = (MethodNode) o;
if(accessModifiers) {
if(m.access == Opcodes.ACC_PRIVATE || m.access == Opcodes.ACC_PROTECTED)
m.access = Opcodes.ACC_PUBLIC;
if(m.access == Opcodes.ACC_PRIVATE + Opcodes.ACC_STATIC || m.access == Opcodes.ACC_PROTECTED + Opcodes.ACC_STATIC)
m.access = Opcodes.ACC_PUBLIC + Opcodes.ACC_STATIC;
if(m.access == Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL || m.access == Opcodes.ACC_PROTECTED + Opcodes.ACC_FINAL)
m.access = Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL;
if(m.access == Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL + Opcodes.ACC_STATIC || m.access == Opcodes.ACC_PROTECTED + Opcodes.ACC_FINAL + Opcodes.ACC_STATIC)
m.access = Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_STATIC;
}
if(injectHooks && m.access != Opcodes.ACC_ABSTRACT &&
m.access != Opcodes.ACC_PUBLIC+Opcodes.ACC_ABSTRACT &&
m.access != Opcodes.ACC_PRIVATE+Opcodes.ACC_ABSTRACT &&
m.access != Opcodes.ACC_PROTECTED+Opcodes.ACC_ABSTRACT &&
m.access != Opcodes.ACC_FINAL+Opcodes.ACC_ABSTRACT &&
m.access != Opcodes.ACC_PUBLIC+Opcodes.ACC_FINAL+Opcodes.ACC_ABSTRACT &&
m.access != Opcodes.ACC_PRIVATE+Opcodes.ACC_FINAL+Opcodes.ACC_ABSTRACT &&
m.access != Opcodes.ACC_PROTECTED+Opcodes.ACC_FINAL+Opcodes.ACC_ABSTRACT &&
m.access != Opcodes.ACC_PUBLIC+Opcodes.ACC_FINAL+Opcodes.ACC_STATIC+Opcodes.ACC_ABSTRACT &&
m.access != Opcodes.ACC_PRIVATE+Opcodes.ACC_FINAL+Opcodes.ACC_STATIC+Opcodes.ACC_ABSTRACT &&
m.access != Opcodes.ACC_PROTECTED+Opcodes.ACC_FINAL+Opcodes.ACC_STATIC+Opcodes.ACC_ABSTRACT)
{
boolean inject = true;
if(m.instructions.size() >= 2 && m.instructions.get(1) instanceof MethodInsnNode) {
MethodInsnNode mn = (MethodInsnNode)m.instructions.get(1);
if(mn.owner.equals("the/bytecode/club/bytecodeviewer/plugins/EZInjection")) //already been injected
inject = false;
}
if(inject) {
//make this function grab parameters eventually
m.instructions.insert(new MethodInsnNode(Opcodes.INVOKESTATIC,
"the/bytecode/club/bytecodeviewer/plugins/EZInjection",
"hook",
"(Ljava/lang/String;)V"));
m.instructions.insert(new LdcInsnNode(classNode.name+"."+m.name+m.desc));
}
}
}
}
if(sandboxRuntime) {
ASMUtil_OLD.renameClassNode("java/lang/Runtime", "the/bytecode/club/bytecodeviewer/RuntimeOverride");
}
if(sandboxSystem) {
ASMUtil_OLD.renameMethodNode("java/lang/System", "exit", "(Ljava/lang/String;)V", "the/bytecode/club/bytecodeviewer/plugins/EZInjection", null, null);
}
if(useProxy) {
try {
String[] split = proxy.split(":");
setProxy(split[0], split[1]);
} catch(Exception e) {
//ignore
}
}
print("Done setting up.");
setFinished();
if(invokeMethod) {
for(ClassNode cn : BytecodeViewer.getLoadedClasses()) //load all the classnodes into the classloader
the.bytecode.club.bytecodeviewer.api.BytecodeViewer.getClassNodeLoader().addClass(cn);
print("Invoking " + invokeMethodInformation+":"+BytecodeViewer.nl+BytecodeViewer.nl);
for(ClassNode classNode : classNodeList) {
for(Object o : classNode.methods.toArray()) {
MethodNode m = (MethodNode) o;
String methodInformation = classNode.name+"."+m.name+m.desc;
if(invokeMethodInformation.equals(methodInformation)) {
for(Method m2 : the.bytecode.club.bytecodeviewer.api.BytecodeViewer.getClassNodeLoader().nodeToClass(classNode).getMethods()) {
if(m2.getName().equals(m.name)) {
try {
m2.invoke(classNode.getClass().newInstance(), (Object[])new String[1]);
if(launchKit)
new GraphicialReflectionKit().setVisible(true);
} catch (Exception e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
print(sw.toString());
}
}
}
}
}
}
}
BytecodeViewer.viewer.setIcon(false);
}
}

View File

@ -11,6 +11,8 @@ import org.objectweb.asm.tree.MethodInsnNode;
import org.objectweb.asm.tree.MethodNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.api.Plugin;
import the.bytecode.club.bytecodeviewer.api.PluginConsole;
/**
* The idea/core was based off of J-RET's Malicious Code Searcher
@ -79,7 +81,7 @@ public class MaliciousCodeScanner extends Plugin {
for(Object o : classNode.methods.toArray()) {
MethodNode m = (MethodNode) o;
InsnList iList = m.instructions;
for(AbstractInsnNode a : iList.toArray()) {
if (a instanceof MethodInsnNode) {

View File

@ -8,6 +8,7 @@ import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.api.Plugin;
/**
* Supports loading of groovy, python or ruby scripts.
@ -23,10 +24,10 @@ public class PluginManager {
private static Plugin pluginInstance;
public static void runPlugin(Plugin newPluginInstance) {
if(pluginInstance == null || pluginInstance.finished) {
if(pluginInstance == null || pluginInstance.isFinished()) {
pluginInstance = newPluginInstance;
pluginInstance.start(); //start the thread
} else if(!pluginInstance.finished) {
} else if(!pluginInstance.isFinished()) {
BytecodeViewer.showMessage("There is currently another plugin running right now, please wait for that to finish executing.");
}
}

View File

@ -9,6 +9,9 @@ import org.objectweb.asm.tree.InsnList;
import org.objectweb.asm.tree.LdcInsnNode;
import org.objectweb.asm.tree.MethodNode;
import the.bytecode.club.bytecodeviewer.api.Plugin;
import the.bytecode.club.bytecodeviewer.api.PluginConsole;
/**
* Replaces all string and string[] instances with whatever.
*

View File

@ -10,6 +10,8 @@ import org.objectweb.asm.tree.LdcInsnNode;
import org.objectweb.asm.tree.MethodNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.api.Plugin;
import the.bytecode.club.bytecodeviewer.api.PluginConsole;
/**
* Simply shows all the non-empty strings in every single class

View File

@ -5,6 +5,9 @@ import java.util.ArrayList;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.MethodNode;
import the.bytecode.club.bytecodeviewer.api.Plugin;
import the.bytecode.club.bytecodeviewer.api.PluginConsole;
/**
* Simply shows all classes that have a public static void main(String[])
*

View File

@ -5,6 +5,7 @@ import java.util.ArrayList;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.api.Plugin;
/**
* Coming soon.

View File

@ -223,7 +223,7 @@ public class RegexInsnFinder {
"Unknown opcode encountered: "
+ ain.getOpcode());
} catch (final UnexpectedException e) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(e);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
}
offsets[i] = insnString.length();
@ -309,7 +309,7 @@ public class RegexInsnFinder {
if (regexMatcher.find())
return makeResult(regexMatcher.start(), regexMatcher.end());
} catch (final PatternSyntaxException ex) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(ex);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(ex);
}
return new AbstractInsnNode[0];
}
@ -328,7 +328,7 @@ public class RegexInsnFinder {
results.add(makeResult(regexMatcher.start(), regexMatcher.end()));
}
} catch (final PatternSyntaxException ex) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(ex);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(ex);
}
return results;
}
@ -350,7 +350,7 @@ public class RegexInsnFinder {
return result;
}
} catch (final PatternSyntaxException ex) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(ex);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(ex);
}
return new AbstractInsnNode[0][0];
}
@ -373,7 +373,7 @@ public class RegexInsnFinder {
results.add(result);
}
} catch (final PatternSyntaxException ex) {
new the.bytecode.club.bytecodeviewer.gui.StackTraceUI(ex);
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(ex);
}
return results;
}