是否有java类文件/字节码编辑器来编辑指令?

时间:2021-02-18 17:20:53

Is there a utility (or eclipse plugin) for editing java class files? I'd like to manipulate the bytecode of a java class file without recompiling it nor having a complete buildpath.

是否有用于编辑java类文件的实用程序(或eclipse插件)?我想操纵java类文件的字节码而不重新编译它也没有完整的构建路径。

E.g. to rename methods, add/delete instructions, change constants etc.

例如。重命名方法,添加/删除指令,更改常量等。

The only utilities I found are:

我发现的唯一工具是:

  • classeditor but it's very limited in functionality (e.g. renaming of things and manipulating instructions isn't possible).

    但是它的功能非常有限(例如,不能重命名事物和操纵指令)。

  • jbe doesn't save changes (maybe because class verifying fails - before I made any changes, although the class runs perfectly)

    jbe不保存更改(可能因为类验证失败 - 在我进行任何更改之前,尽管类运行完美)

    (jbe initially had a classpath issue, adding the class path to the jbe.bat file helped)

    (jbe最初有一个类路径问题,将jbe.bat文件的类路径添加到了帮助中)

4 个解决方案

#1


8  

I have not seen any byte code -> byte code frontends, but plenty backends.

我还没有看到任何字节代码 - >字节代码前端,但有很多后端。

I would suggest that you have a look at the many byte code manipulation libraries like javassist which allow loading byte code, manipulate it, and save it back to disk, and then write a small main that does exactly that.

我建议您查看许多字节代码操作库,如javassist,它允许加载字节代码,操作它,并将其保存回磁盘,然后编写一个小的main来完成它。

#2


20  

I use reJ for editing class files directly.

我使用reJ直接编辑类文件。

It allows you to edit instructions, methods, constant pool, diff classes, and a split view with a hex editor.

它允许您使用十六进制编辑器编辑指令,方法,常量池,差异类和拆​​分视图。

It's ridiculously awesome.

这真是太可怕了。

#3


6  

I wrote an open source Java assembler and dissasembler you may find useful.

我写了一个开源Java汇编程序和dissasembler,你可能会发现它很有用。

It lets you disassemble a classfile into human readable assembly, edit it, and then reassemble it into a class. It was originally designed for writing obfuscated crackmes, so there are a lot of obscure features it supports that many other tools don't. If you need any features it doesn't currently support, feel free to contact me and I'll see what I can do.

它允许您将类文件反汇编为人类可读的汇编,编辑它,然后将其重新组合成一个类。它最初是为编写混淆的裂缝而设计的,因此它支持许多其他工具所不具备的模糊功能。如果您需要它目前不支持的任何功能,请随时与我联系,我会看到我能做什么。

#4


2  

Find this list of byte code manipulation/code generation libraries helpful?

找到这个字节码操作/代码生成库列表有用吗?

#1


8  

I have not seen any byte code -> byte code frontends, but plenty backends.

我还没有看到任何字节代码 - >字节代码前端,但有很多后端。

I would suggest that you have a look at the many byte code manipulation libraries like javassist which allow loading byte code, manipulate it, and save it back to disk, and then write a small main that does exactly that.

我建议您查看许多字节代码操作库,如javassist,它允许加载字节代码,操作它,并将其保存回磁盘,然后编写一个小的main来完成它。

#2


20  

I use reJ for editing class files directly.

我使用reJ直接编辑类文件。

It allows you to edit instructions, methods, constant pool, diff classes, and a split view with a hex editor.

它允许您使用十六进制编辑器编辑指令,方法,常量池,差异类和拆​​分视图。

It's ridiculously awesome.

这真是太可怕了。

#3


6  

I wrote an open source Java assembler and dissasembler you may find useful.

我写了一个开源Java汇编程序和dissasembler,你可能会发现它很有用。

It lets you disassemble a classfile into human readable assembly, edit it, and then reassemble it into a class. It was originally designed for writing obfuscated crackmes, so there are a lot of obscure features it supports that many other tools don't. If you need any features it doesn't currently support, feel free to contact me and I'll see what I can do.

它允许您将类文件反汇编为人类可读的汇编,编辑它,然后将其重新组合成一个类。它最初是为编写混淆的裂缝而设计的,因此它支持许多其他工具所不具备的模糊功能。如果您需要它目前不支持的任何功能,请随时与我联系,我会看到我能做什么。

#4


2  

Find this list of byte code manipulation/code generation libraries helpful?

找到这个字节码操作/代码生成库列表有用吗?