7

Okay. So I've just come up with the most amazing program for java developers and reverse-engineerers and I was wondering if something like the following program already exists:

What I'm thinking of is like a middle-ground between something like DirtyJOE and a Java Decompiler.

I already know that:

  • It's possible to inject and manipulate code in a compiled class using ASM
  • You can decompile an unobfuscated jar into a readable and understandable state
  • It's practical to explore and edit a class using a GUI because DirtyJOE can do that amazingly well

So is there some sort of program that can show me a decompiled class and allow me to manipulate/inject into different parts of it individually?

For example, I would like replace one method with my own or change a field's access within a compiled class file.

So basically I'm looking for a frontend for ASM built with an interface based on decompiled source code.

Does this exist? If not, what's the closest thing I'm going to get to it?

  • Have you tried IDA Pro? – Antimony Jul 26 '14 at 18:42
  • Can IDA actually edit stuff, though? I've never really used IDA that much. – Taconut Jul 26 '14 at 18:51
4

You can try using javasnoop (https://code.google.com/p/javasnoop/) to accomplish something similar.

Here's a tutorial for using it -

http://resources.infosecinstitute.com/hacking-java-applications-using-javasnoop/

  • After looking at a video showcasing JavaSnoop, I have now decided that it is by far the coolest program in existence. However, I can't seem to get the "Attach to existing process" working. Thinking it was my JRE, I tried 32xJRE7, 64xJRE7, 64xJDK7, and 64xJDK6 (all of which didn't let me attach onto any of the applets or programs I had running in the background). Currently, I'm using reJ (from Extreme Coders' answer), but this program seems like it would benefit me much more. – Taconut Jul 28 '14 at 19:38
  • Have you had a look in the Readme (javasnoop.googlecode.com/svn-history/r32/trunk/resources/…) for Javasnoop ? It lists a number of steps required to setup Javasnoop correctly. Other than those steps, maybe you could try running it with Admin privileges ? – REnoob Jul 29 '14 at 5:51
  • I had to specifically run the bat file from an Administrator command prompt. I was trying to right-click on the bat file and select "Run as Administrator." That didn't work. – Taconut Jul 31 '14 at 21:47
6

Some tools you can use. However note that none of them has the ability to recompile classes, i.e you cannot decompile a single class to source, modify it, and then recompile back. It may be possible using Reflection API but then you need to do a lot of modification on the decompiled source itself. Other ways may be to decompile the entire bunch of classes and then recompile all when done.

Class Editor

This is a tool to open Java class file binaries, view their internal structure, modify portions of it if required and save the class file back. It also generates readable reports similar to the javap utility. Easy to use Java Swing GUI. The user interface tries to display as much detail as possible and tries to present a structure as close as the actual Java class file structure. At the same time ease of use and class file consistency while doing modifications is also stressed. For example, when a method is deleted, the associated constant pool entry will also be deleted if it is no longer referenced. In built verifier checks changes before saving the file. This tool has been used by people learning Java class file internals. This tool has also been used to do quick modifications in class files when the source code is not available.

JBE - Java Bytecode Editor

JBE is a bytecode editor suitable for viewing and modifying java class files. It is built on top of the open-source jclasslib bytecode viewer by ej-technologies. For verification and exporting the class files, JBE uses the the Bytecode Engineering Library by Apache's Jakarta project.

Class Construction Kit

The Class Construction Kit is a tool for the visual creation or modification of Java class files. It is implemented using BCEL and Swing.

reJ

The reJ project aims to allow improved visibility into Java class files, whether they were created compiling from Java sources, another language or by any other kind of tool. Basically anything that will run in a Java Virtual Machine. reJ is a library and a graphical tool for inspection (viewing, searching and comparing) and manipulation (modification, obfuscation, refactoring of methods, fields, attributes and code) of classfiles for the Java platform.

BcelEditor

BcelEditor is a tool for the visual modification of Java class files. It is implemented using BCEL.
Note: You need to register on the site to get access

MethodBodyEditor for Java

A Java class editor
Note: You need to register on the site to get access

Other than this, some other generic java tools are available on tuts4you

  • Man! ReJ is awesome! I guess this is the best it gets for editing jars. I might create a tool, but I'd need so much reflection... Anyway, thank you. I'll definitely use these tools for the foreseeable future. – Taconut Jul 31 '14 at 21:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.