Re java

From dslsdzc/rev-skills · View interactive version

Re java is an AI agent skill from the GitHub repository dslsdzc/rev-skills. Java 字节码逆向:CFR/JD-GUI、jar 解包、Java 加固。触发词:Java、jar、字节码、JD-GUI、CFR、class文件

How to use this skill

Skill file

Java 字节码逆向(CFR / JD-GUI / javap)

何时使用 / 何时不用

工具准备

参考 [[re-analyze/platform-tips]]——反编译/解包为静态步骤,免沙箱;动态验证按最高原则进沙箱。

JDK(javap / jar / java 运行时)

unzip(jar = zip 容器)

CFR(jar CLI 反编译器,零依赖)

JD-GUI(GUI 反编译器)

procyon(备选反编译器)

操作步骤

按顺序执行,每步记录证据(路径 + sha256,见 [[re-triage]])。

  1. jar/war 解包:

```sh

jar tf app.jar # 先看清单(JDK 自带 jar 工具)

unzip -o app.jar -d unpacked/

unzip -p app.jar META-INF/MANIFEST.MF # Main-Class / 加固标记

```

  1. 类结构识别:

```sh

javap -c -p unpacked/com/example/Main.class # 字节码(-c)+ 私有成员(-p)

javap -v unpacked/com/example/Main.class # 常量池/元数据

```

  1. 逻辑还原(CFR / JD-GUI):

```sh

java -jar cfr.jar app.jar --outputdir cfr_out/ # 整包还原为 Java 源码

java -jar cfr.jar unpacked/com/example/Main.class # 单类还原

java -jar procyon-decompiler.jar -jar app.jar -o procyon_out/ # 备选

```

  1. 混淆识别与字符串解密:
  1. 动态(可选;沙箱内执行 [[re-sandbox]]):

```sh

jdb -classpath app.jar com.example.Main

> stop in com.example.Main.checkKey # 下断点

> print key # 取变量

> eval new com.example.Util().decrypt("密文") # 直接调用解密方法取明文

```

```js

Java.perform(function () {

var c = Java.use("com.example.Main");

c.checkKey.implementation = function (k) {

console.log("key = " + k);

return this.checkKey(k);

};

});

```

跨域联合

常见坑与陷阱

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.