@@ -45,6 +45,7 @@ The engine is built on the **ASM bytecode analysis framework** and uses a **mult
4545- 📦 ** Spring Boot / WAR Support** — Nested JAR parsing and class name correction, perfectly adapted for Fat JARs
4646- 🛡️ ** Security Protection** — Built-in Zip Slip path traversal attack defense with automatic error tolerance for corrupted class files
4747- 🔌 ** Dual-Mode Usage** — Works as both a standalone CLI tool and an embeddable Java library
48+ - 🔓 ** Built-in Decompilation** — Integrated FernFlower decompiler engine, supports CLI decompilation of specific classes with source code output
4849
4950## 🚀 Quick Start
5051
@@ -74,6 +75,11 @@ java -jar jar-analyzer-engine.jar --jar /path/to/app.jar
7475# Analyze all JARs in a directory
7576java -jar jar-analyzer-engine.jar --jar /path/to/libs/
7677
78+ # Decompile a specific class (requires prior build or --jar for auto build)
79+ java -jar jar-analyzer-engine.jar --decompile com.example.MyClass
80+
81+ # First time use: auto build + decompile
82+ java -jar jar-analyzer-engine.jar --jar /path/to/app.jar --decompile com.example.MyClass
7783```
7884
7985After analysis, a SQLite database file ` jar-analyzer.db ` will be generated in the current directory and can be queried with any SQLite client tool. Temporary files during analysis are stored in the ` jar-analyzer-temp ` directory, which can be manually deleted after analysis completes.
@@ -99,6 +105,7 @@ After analysis, a SQLite database file `jar-analyzer.db` will be generated in th
99105| ` --white-list <text> ` | ` -w ` | None | Class/package whitelist (inline text) |
100106| ` --black-list-file <file> ` | — | None | Read blacklist from file |
101107| ` --white-list-file <file> ` | — | None | Read whitelist from file |
108+ | ` --decompile <class> ` | ` -d ` | None | Decompile a specific class and print source to console (e.g. ` com.example.MyClass ` ) |
102109| ` --help ` | ` -h ` | — | Display help information |
103110
104111## 📚 Argument Details
@@ -196,6 +203,28 @@ Enabling `--no-fix-impl` disables this behavior, keeping only the **literal dire
196203java -jar jar-analyzer-engine.jar --jar app.jar --no-fix-impl
197204```
198205
206+ ### ` --decompile ` / ` -d ` (Decompile Mode)
207+
208+ Specify a fully-qualified class name, and the engine will locate the corresponding class file in the ` jar-analyzer-temp ` directory, decompile it to Java source code using the built-in FernFlower decompiler, and output the result to the console.
209+
210+ Supported class name formats:
211+ - Dot-separated: ` com.example.service.UserService `
212+ - Slash-separated: ` com/example/service/UserService `
213+
214+ The engine automatically handles:
215+ - ** Spring Boot Fat JAR** : Searches under ` BOOT-INF/classes/ ` prefix
216+ - ** WAR files** : Searches under ` WEB-INF/classes/ ` prefix
217+ - ** Inner classes** : Automatically includes ` $ ` inner class files for decompilation
218+ - ** Fuzzy matching** : When the class is not found, searches the temp directory and provides "Did you mean?" suggestions
219+
220+ ``` bash
221+ # Already built (temp directory exists), decompile directly
222+ java -jar jar-analyzer-engine.jar --decompile com.example.MyClass
223+
224+ # First time use: auto build + decompile
225+ java -jar jar-analyzer-engine.jar --jar app.jar --decompile com.example.MyClass
226+ ```
227+
199228### Blacklist & Whitelist Filtering
200229
201230Blacklists and whitelists allow you to control which classes participate in analysis, reducing unnecessary analysis scope and speeding up the process.
@@ -473,6 +502,19 @@ java -jar jar-analyzer-engine.jar \
473502 --rt /usr/lib/jvm/java-8-openjdk/jre/lib/rt.jar
474503```
475504
505+ ### 6. Decompile a Specific Class
506+
507+ ``` bash
508+ # Analyze + decompile in one step
509+ java -jar jar-analyzer-engine.jar \
510+ --jar app.jar \
511+ --decompile com.example.service.UserService
512+
513+ # Already built, decompile directly
514+ java -jar jar-analyzer-engine.jar \
515+ --decompile com.example.service.UserService
516+ ```
517+
476518## 🤖 AI Integration for Code Auditing
477519
478520The generated SQLite database is naturally suited for use with AI tools. Here is the recommended workflow:
@@ -579,6 +621,9 @@ jar-analyzer-engine/
579621│ │ ├── mapper/ # MyBatis Mapper interfaces (15)
580622│ │ └── reference/ # Core data models
581623│ ├── entity/ # Database entity classes (18)
624+ │ ├── decompile/ # Decompilation module
625+ │ │ ├── DecompileEngine.java # FernFlower decompiler wrapper
626+ │ │ └── LRUCache.java # Decompilation result LRU cache
582627│ └── analyze/spring/ # Spring framework analysis
583628│ ├── SpringService.java # Spring analysis entry point
584629│ └── asm/ # Spring annotation ASM visitors
0 commit comments