The modern Java bytecode editor

Overview

Recaf Discord Build Status downloads Contributions welcome

screenshot of recaf

An easy to use modern Java bytecode editor that abstracts away the complexities of Java programs. Recaf abstracts away:

  • Constant pool
  • Stack frames
  • Wide instructions
  • And more!

Don't know bytecode? That's ok because Recaf supports recompiling decompiled code and inserting single line Java statements into the bytecode.

For more information: Read the documentation

Download

See the releases page for the latest build.

Preface

If you're just getting started with reverse-engineering in Java, read primer guide. Then check the documentation pages.

Contributing

Are you a developer?

Check out the open issues, project boards, and many scattered TODO messages throughout the source code. There's plenty to do.

Not a developer?

You can help by reporting bugs, making suggestions, providing translations, and sharing this project.

More information can be found in the contribution guide.

Setting up the project

Clone the repository via git clone https://github.com/Col-E/Recaf.git

Open the project in an IDE or generate the build with maven.

IDE:

  1. Import the project from the pom.xml
    • IntelliJ
    • Eclipse - (Warning: Eclipse's custom compiler cannot compile Recaf because of incorrect generics parsing)
  2. Create a run configuration with the main class me.coley.recaf.Recaf

Without IDE:

  1. Execute build
    • Follow the prompt in the script to build the project.
  2. Run the generated build: java -jar target/recaf-{version}-jar-with-dependencies.jar

For additional information, join the Discord server (https://discord.gg/Bya5HaA)

Comments
  • Efficiency Improvements

    Efficiency Improvements

    C&P Support

    Allow users to copy/paste methods/variables/sections of bytecode.

    Extra details:

    • Ideally convert the specific resource to text and put in in the OS clipboard - this allows sharing via pastebin as well as cross-process C&P.
    • Most important for instructions and methods, as variables are quicker to add and classes can be duplicated with winrar.

    Keyboard Instruction Input

    Either allow the insertion of new instructions via shortcuts, or, even better, allow us to write instructions as text which is then parsed to bytecode (for bonus points, add autocomplete for instruction and class/variable names).

    Extra details:

    • Obviously the smarter the suggestion the system can provide, the better, but simple syntax checking with suggestions of instruction names and jar/project-local class/field names would already be quite efficient. Add previously used non-local class names to the list, and it's close to perfect.
    • Requires some additional UI, but speeds up work flow considerably (writing instructions w/ autocomplete might be more than ten times as fast as selecting them via UI).

    Recompile Feature

    This might take a lot of work, but it would be nice if users could just modify the java code in the decompile window and let the application do the conversion to bytecode. I personally like the freedom direct instruction editing gives, but for most users this addition would make Recaf a much more powerful tool.

    Extra details:

    • If the library used for decompiling can already reverse this process, integration should be quite simple.
    • Ideally the bytecode should change as little as possible when making small tweaks, though this is of low importance.

    Minor Enhancements

    Simple:

    • Remember the last path used for opening/saving files.
    • Add recent files/folders list to file menu.
    • Ask before quitting if changes occured since last save.
    • Doubleclick on a class/method should open its definition in a new window (decompile and bytecode view).
    • Rightclick on a class/method should give option to open definition/search for uses/refactor(rename everywhere) (decompile and bytecode view).
    • Add window that lists (other) open windows. Advanced:
    • Allow multicursor selection for editing instrutions
    • Add regex search/replace with functional conditions (ie. class name that starts with "wi", data type name "int" (useful eg. if you don't want to want to change the class name Mint to Mlong, but all ints to longs)
    • Structure Detection: Allow semiautomatic application of simple structure rules (automate repetetive tasks; eg. if you want to add several class entries to an array, the constructor code for them could be automatically generated when C&P duplicating the last 3 entries (should be optional/configurable)
    • Allow using tabs instead of new windows?

    For C# there is a program called DNSpy, which allows you to edit C# bytecode extremely efficiently. If you are looking for further enhancements/extensions for Recaf, it is probably the best example to compare yourself to.

    enhancement 
    opened by shadoxxhd 30
  • 2.0 does not patch itself

    2.0 does not patch itself

    openjdk-bin-11

    bash$ java -jar recaf-1.15.10.jar 
    Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on
    Detected JDK 11+ without OpenJFX dependencies
    Dependencies will be downloaded and Recaf will restart...
    Rerunning
    
    
    bash $ java -jar recaf-2.0.0-J8-jar-with-dependencies.jar 
    Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on
    INFO: Recaf-2.0.0
    Exception in thread "main" java.lang.NoClassDefFoundError: javafx/concurrent/Task
            at me.coley.recaf.command.impl.Initializer.run(Initializer.java:43)
            at picocli.CommandLine.executeUserObject(CommandLine.java:1769)
            at picocli.CommandLine.access$900(CommandLine.java:145)
            at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2150)
            at picocli.CommandLine$RunLast.handle(CommandLine.java:2144)
            at picocli.CommandLine$RunLast.handle(CommandLine.java:2108)
            at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:1975)
            at picocli.CommandLine.execute(CommandLine.java:1904)
            at me.coley.recaf.Recaf.main(Recaf.java:41)
    Caused by: java.lang.ClassNotFoundException: javafx.concurrent.Task
            at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
            at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
            at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
            ... 9 more
    
    
    bug enhancement 
    opened by blshkv 23
  • Java application not showing up in attach menu (jvm attach disabled)

    Java application not showing up in attach menu (jvm attach disabled)

    I'm pretty sure it should, as when I write my own Java code to show all available VMs, it shows up. I'm not sure what else I can say but is there any reason it might not be showing up? The application name is Lunar Client (minecraft thing if anyone knows). However, I can see Forge 1.8.9 but not Lunar

    usage 
    opened by xrnss 22
  • ALOAD 0 randomly being an issue

    ALOAD 0 randomly being an issue

    Describe the bug

    Using the Assembler to view the bytecode sometimes I encounter ALOAD 0 being an issue (Varification failed on line : x) (Error at instruction x: Copying an uninitialized value should not occur!)

    To Reproduce

    Steps to reproduce the behavior:

    1. load Main.class
    2. Navigate to the methods tab (table mode)
    3. Open the public static void main method with a string array as an argument
    4. See error on line 955

    Screenshots

    Capture Capture1

    Main.zip

    bug Can't reproduce 
    opened by Anonymous-275 21
  • Recompiling class with inner classes corrupts class

    Recompiling class with inner classes corrupts class

    I used Recaf to manipulate a proprietary jar file so that it would log more information that is needed to analyze a problem.

    Adding some System.log.println to various classes and recompiling the classes worked fine, until I changed something in a class that had an inner class. Recompiling was allegedly successful, but the exported jar is unusable. When trying to decompile the respective class again, Recaf freezes.

    Not sure if this is a general problem or somehow related to this particular jar file. If needed I can provide the jar.

    bug 
    opened by nordleuchte 15
  • Illegal named methods or variable names

    Illegal named methods or variable names

    You know that there are words that we cant use while declaring a method or a variable. BUT FU***NG OBFUSCATORS CAN! I spent more than 30 hours dealing with bugs. I got mad, sorry.

    If an obfuscator rename a variable with an illegal(unicode or reserved keywords), this causes Recaf suck while parsing decompiled code. If an variable name gets invisible, that means it is unicode, but if a method name gets unparseable, it means you cant even change it's name using table mode.

    In my jar, there are 2 methods named "do" and "if" and maybe a lot more. I don't know if it is your job to fix this but it causes your program to cant even rename this illegal method. If you say that is not my job, i will open an issue on "Java Deobfuscator" repo.

    Btw, you can run CFR with -renameillegalidents to prevent unicode bug.

    bug 
    opened by MizzMaster 14
  • Exception at com.apple.laf.AquaMenuPainter.paintMenuBarBackground(AquaMenuPainter.java:145)

    Exception at com.apple.laf.AquaMenuPainter.paintMenuBarBackground(AquaMenuPainter.java:145)

    I'm using recaf to edit target/recaf-0.9-jar-with-dependencies.jar itself, it sometimes raises exception like this ... although the application did not crash, but you might wanna look at it

    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    	at com.apple.laf.AquaMenuPainter.paintMenuBarBackground(AquaMenuPainter.java:145)
    	at com.apple.laf.AquaMenuBarUI.paint(AquaMenuBarUI.java:74)
    	at javax.swing.plaf.ComponentUI.update(ComponentUI.java:161)
    	at javax.swing.JComponent.paintComponent(JComponent.java:780)
    
    bug 
    opened by CaledoniaProject 14
  • Some classes cant be disassembled

    Some classes cant be disassembled

    I came over a few classes, that could not be decompiled

    I loaded them into recaf and it detected them as classes but I could not open them in any way. The JVM has no issues running them.

    To Reproduce

    Steps to reproduce the behavior:

    1. Extract sample
    2. Load class Bootstrap.class
    3. See error

    Screenshots Screenshot_09_19_19

    Help wanted 3rd party problem 
    opened by FlawlessDeveloper 13
  • Integrated work related to plugin UI

    Integrated work related to plugin UI

    What's new

    The data used for UI is ready, and the work of the remaining UI window has not begun.

    Hate the follow up JavaFX work, Can someone help me finish it. lol

    1. Add CellUpdateListener to allow plugin and script applications to update the context menu's ability.
    2. The prototype of UI is IDEA Plugin image

    What's fixed

    Fix some plugin related errors

    enhancement 3.X 
    opened by xtherk 12
  • Recaf crashes due to path lookup failure via Powershell/Directories-JVM

    Recaf crashes due to path lookup failure via Powershell/Directories-JVM

    Describe the bug

    Can't run the recaf-2.7.0-J8-jar-with-dependencies.jar with corretto-11.0.8.10.1 on Windows 10.

    To Reproduce

    Steps to reproduce the behavior:

    1. java -jar recaf-2.7.0-J8-jar-with-dependencies.jar
    2. See error

    Exception

    If applicable, add the exception/stacktrace.

    Exception in thread "main" java.lang.ExceptionInInitializerError
            at me.coley.recaf.Recaf.init(Recaf.java:75)
            at me.coley.recaf.Recaf.main(Recaf.java:45)
    Caused by: java.lang.NullPointerException
            at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:98)
            at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
            at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
            at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
            at java.base/java.nio.file.Path.of(Path.java:147)
            at java.base/java.nio.file.Paths.get(Paths.java:69)
            at me.coley.recaf.Recaf.getDirectory(Recaf.java:167)
            at me.coley.recaf.Recaf.getDirectory(Recaf.java:177)
            at me.coley.recaf.util.self.SelfDependencyPatcher.<clinit>(SelfDependencyPatcher.java:28)
            ... 2 more
    

    Screenshots

    If applicable, add screenshots to help explain your problem.

    bug 3rd party problem 
    opened by SetoKaiba 12
  • Compile snippets into bytecode in assembler

    Compile snippets into bytecode in assembler

    Compile snippets into bytecode in assembler

    The idea is to allow users to open a method assembler, then open a prompt allowing them to type in something like System.out.println("test"). This line would then be compiled against the current source and inserted into the assembler as lines of method bytecode.

    It would be nice to support arbitrary variable support too, such as: if ($0 != 0){} --> *LOAD 0

    enhancement 
    opened by Col-E 12
  • Empty create workspace window

    Empty create workspace window

    When I run on latest dev3 branch (gradlew run), and when I add jar files to recaf gui in windows, I get this "Create Workspace" window that I cannot close and it is empty. Can only kill the app.

    image

    Can't reproduce JavaFX 3rd party problem 3.X 
    opened by bojanv55 23
  • Add live search to searches [WIP]

    Add live search to searches [WIP]

    recaf TODO:

    • [ ] Use Virtualized Context
    • [ ] Implement for other searches
    • [ ] Make Result also contain where specifically the match occurred (useful for RegEx)
    enhancement 3.X ux 
    opened by Amejonah1200 1
  • Add Call Graph [WIP]

    Add Call Graph [WIP]

    recaf

    TODO:

    • [x] Call Graph Docking
      • [x] Move to own Window
      • [x] Bundle in one TabPane for Docking
      • [x] Refocus of method (navigation)
    • [x] Method Handles (?)
    • [x] Dynamic methods
    • [x] Fix NPE
    • [x] Support for workspace updates:
      • [x] Add Library
      • [x] Add new class
      • [x] Update Class
      • [x] Delete Class
      • [x] Remove Library
    • [x] LinkerResolver caching
    • [x] Show unresolved calls
    • [ ] Cache ClassInfo?
    • [ ] Make Toggle for Call Graph
    • [ ] Threading Issues?
    enhancement 3.X 
    opened by Amejonah1200 3
  • Unreferenced class detection

    Unreferenced class detection

    What's new

    • Classes are now aware of their source type (primary, library, internal library, phantom generated)
    • Add system for tracking classes that are referenced by code that will execute at runtime, this allows us to show a warning for unused classes when you try to decompile them.
    enhancement 3.X 
    opened by yapht 0
Releases(2.21.13)
Owner
Matt
Java enthusiast. Discord: Col-E#6255
Matt
Java bytecode engineering toolkit

Java bytecode engineering toolkit Javassist version 3 Copyright (C) 1999-2020 by Shigeru Chiba, All rights reserved. Javassist (JAVA programming ASSIS

null 3.7k Dec 29, 2022
Mixin is a trait/mixin and bytecode weaving framework for Java using ASM

Mixin is a trait/mixin framework for Java using ASM and hooking into the runtime classloading process via a set of pluggable built-in or user-provided

SpongePowered 1.1k Jan 7, 2023
Jitescript - Java API for Bytecode

Jitescript - Java API for Bytecode This project is inspired by @headius's BiteScript. The goal is to produce a Java library with a similar API so that

Doug Campos 182 Dec 7, 2022
Chasm is a java bytecode transformer designed to handle collision between transformers wherever possible.

NOTE: This project is still in its early development. There's guaranteed bugs and missing functionality. Chasm - Collision Handling ASM What is Chasm?

null 51 Dec 30, 2022
cglib - Byte Code Generation Library is high level API to generate and transform Java byte code. It is used by AOP, testing, data access frameworks to generate dynamic proxy objects and intercept field access.

cglib Byte Code Generation Library is high level API to generate and transform JAVA byte code. It is used by AOP, testing, data access frameworks to g

Code Generation Library 4.5k Jan 8, 2023
A Java 8+ Jar & Android APK Reverse Engineering Suite (Decompiler, Editor, Debugger & More)

Bytecode Viewer Bytecode Viewer - a lightweight user friendly Java Bytecode Viewer. New Features WAR & JSP Loading JADX-Core Decompiler Fixed APK & de

Kalen (Konloch) Kinloch 13.5k Jan 7, 2023
A java based course editor for the AutoDrive mod, works with both the FS19 + FS22 versions of the mod

Java Java version greater than 13 is required. JRE or JDK are both possible. Current Java versions can be downloaded here: https://www.oracle.com/java

null 47 Jan 1, 2023
🗺️ Minecraft map editor and mod

A Minecraft Map Editor... that runs in-game! With selections, schematics, copy and paste, brushes, and scripting! Use it in creative, survival in sing

EngineHub 2.7k Jan 1, 2023
Markdown editor control for JavaFX

An advanced markdown-editor control for JavaFX.

Daniel Gyoerffy 23 Dec 28, 2022
Source code of APK-Explorer-Editor (AEE), an open-source tool to explore the contents of an installed APK!

APK Explorer & Editor (AEE) APK Explorer & Editor, an open-source tool to explore the contents of an installed APK, is strictly made with an aim to in

APK Explorer & Editor 271 Jan 8, 2023
An Editor for CSGO:botprofile.db, allows you to create&improve your own bot easily.

botprofileEditor An Editor for CSGO:botprofile.db, allows you to create&improve your own bot easily. 最新信息 项目重构,舍弃了原来复杂的结构 项目打算全力制作web版,使用SpringBoot作为开

null 10 Oct 9, 2022
🌄 Image editor using native modules for iOS and Android. Inherit from 2 available libraries, Brightroom (iOS) and PhotoEditor (Android)

React Native Photo Editor (RNPE) ?? Image editor using native modules for iOS and Android. Inherit from 2 available libraries, Brightroom (iOS) and Ph

Baron Ha. 243 Jan 4, 2023
IntelliJ Platform A full-featured WYSIWYG editor for markdown

markdown-editor IntelliJ Platform A full-featured WYSIWYG editor for markdown English Document 中文文档 Useful Links Custom Style Features Support three e

null 101 Dec 19, 2022
With the games: brick breakers, tic-tac-toe, snake and tetris With the apps: calculator, stopwatch and text editor Themes, and hyperlinks

Game-Launcher --------------------- ABOUT THE GAME LAUNCHER ------------------------- With the games: brick breakers, tic-tac-toe, snake and tetris Wi

João Devesa 2 Dec 26, 2021
Convenient search view for Eclipse to find/replace within the currently active editor.

Find/Replace View plugin for Eclipse Feedback and high-quality pull requests are highly welcome! About What is it? Installation Building from Sources

Sebastian Thomschke 3 May 25, 2022
A beautiful and customizable text editor.✨

Tawfekh-Editor A beautiful and customizable text editor. ✨ Tawfekh Editor is simple and easy to use. You can Customize it as you want to get the best

Médoune Siby Georges Baldé 9 Jan 1, 2023
Java bytecode engineering toolkit

Java bytecode engineering toolkit Javassist version 3 Copyright (C) 1999-2020 by Shigeru Chiba, All rights reserved. Javassist (JAVA programming ASSIS

null 3.7k Dec 29, 2022
Mixin is a trait/mixin and bytecode weaving framework for Java using ASM

Mixin is a trait/mixin framework for Java using ASM and hooking into the runtime classloading process via a set of pluggable built-in or user-provided

SpongePowered 1.1k Jan 7, 2023
Log analyser / visualiser for Java HotSpot JIT compiler. Inspect inlining decisions, hot methods, bytecode, and assembly. View results in the JavaFX user interface.

JITWatch Log analyser and visualiser for the HotSpot JIT compiler. Video introduction to JITWatch video Slides from my LJC lightning talk on JITWatch

AdoptOpenJDK 2.8k Jan 3, 2023