JAVA的class文件反编译工具jad的应用

2023-10-22 15:52

本文主要是介绍JAVA的class文件反编译工具jad的应用,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

java的class文件反编译工具jad的应用

JAD下载地址:http://www.varaneckas.com/jad
JAD用法具体用法:

Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov (jad@kpdus.com).
Usage:    jad [option(s)] <filename(s)>
Options: -a       - generate JVM instructions as comments (annotate)
         -af      - output fully qualified names when annotating
         -b       - generate redundant braces (braces)
         -clear   - clear all prefixes, including the default ones
         -d <dir> - directory for output files
         -dead    - try to decompile dead parts of code (if there are any)
         -dis     - disassembler only (disassembler)
         -f       - generate fully qualified names (fullnames)
         -ff      - output fields before methods (fieldsfirst)
         -i       - print default initializers for fields (definits)
         -l<num>  - split strings into pieces of max <num> chars (splitstr)
         -lnc     - output original line numbers as comments (lnc)
         -lradix<num>- display long integers using the specified radix
         -nl      - split strings on newline characters (splitstr)
         -noconv  - don't convert Java identifiers into valid ones (noconv)
         -nocast  - don't generate auxiliary casts
         -noclass - don't convert .class operators
         -nocode  - don't generate the source code for methods
         -noctor  - suppress the empty constructors
         -nodos   - turn off check for class files written in DOS mode
         -nofd    - don't disambiguate fields with the same names (nofldis)
         -noinner - turn off the support of inner classes
         -nolvt   - ignore Local Variable Table entries (nolvt)
         -nonlb   - don't insert a newline before opening brace (nonlb)
         -o       - overwrite output files without confirmation                                    //不提示,覆盖源文件
         -p       - send all output to STDOUT (for piping)                                           //将反编译结果输出到屏幕
         -pa <pfx>- prefix for all packages in generated source files
         -pc <pfx>- prefix for classes with numerical names (default: _cls)
         -pe <pfx>- prefix for unused exception names (default: _ex)
         -pf <pfx>- prefix for fields with numerical names (default: _fld)
         -pi<num> - pack imports into one line using .* (packimports)
         -pl <pfx>- prefix for locals with numerical names (default: _lcl)
         -pm <pfx>- prefix for methods with numerical names (default: _mth)
         -pp <pfx>- prefix for method parms with numerical names (default:_prm)
         -pv<num> - pack fields with the same types into one line (packfields)
         -r       - restore package directory structure
         -radix<num>- display integers using the specified radix (8, 10, or 16)
         -s <ext> - output file extension (default: .jad)              //jad -sJava test.class 反编译结果以.Java为扩展名。
         -safe    - generate additional casts to disambiguate methods/fields
         -space   - output space between keyword (if, while, etc) and expression
         -stat    - show the total number of processed classes/methods/fields
         -t<num>  - use <num> spaces for indentation (default: 4)
         -t       - use tabs instead of spaces for indentation
         -v       - show method names while decompiling
         -8       - convert Unicode strings into ANSI strings (ansi)
         -&       - redirect STDERR to STDOUT

 

 

 

以下是对上述部分参数的解释:

 

-a - 用JVM字节格式来注解输出
-af - 同 -a,但是注解的时候用全名称
-clear - 清除所有的前缀
-b - 输出多于的括号 (e.g., if(a) { b(); }, default: no)
-d <dir> - 指定输出文件的文件目录
-dead -试图反编译代码的dead 部分(default: no)
-disass - 不用用字节码的方式反编译 (no JAVA source generated)
-f - 输出整个的名字,无论是类还是方法
-ff -输出类的成员在方法之前 (default: after methods)
-i - 输出所有的变量的缺省的最初值
-l<num> - 将strings分割成指定数目的块的字符 (default: no)
-lnc - 将输出文件用行号来注解 (default: no)
-nl - 分割strings用新行字符 newline character (default: no)
-nodos -不要去检查class文件是否以dos方式写 (CR before NL, default: check)
-nocast - 不要生成辅助文件
-nocode -不要生成方法的源代码
-noconv - 不要转换java的定义符 (default: do)
-noctor - 不允许空的构造器存在
-noinner -关掉对内部类的支持 (default: turn on)
-nolvt - 忽略局部变量的表信息
-nonlb - 不要输出一个新行在打开一个括号之前 (default: do)
-o - 无需确认直接覆盖输出 (default: no)
-p - 发送反编译代码到标准输出 STDOUT (e.g., for piping)

 

 

jad:反编译工具
可以将class文件反编译成java文件
假设将jad.exe安装在f:/java/jad目录下
把要反编译的文件*.class复制到此目录下,接着接以下步骤,
在命令行窗口环境中进入jad目录,
然后运行:jad -s java *.class  (附,*.class指要反编译的文件名)
如果*.class文件和jad程序不在同一个目录,就要用到path环境变量,
将jad 所在目录加到path路径中即可:set path=%path%;f:/java/jad
若要了解jad更为详细的使用帮助信息,直接运行jad.exe查看

以下假设jad.exe在c:/java目录下


直接输入类文件名,且支持通配符,如下所示。
c:/Java/>jad test.class
c:/Java/>jad *.class
结果是将test.class反编译为test.jad。将test.jad改为test.Java即得源文件。

jad -p test.class>test.Java   //将反编译结果重定向到文件
jad -o -dtest -sJava *.class  //指定反编译的输出文件目录

 

将d:/1/文件夹下的.class文件按照原程序的包结构反编译到test目录下。

c:/java/>jad -o -r -dtest -sjava d:/1/**/*.class

这篇关于JAVA的class文件反编译工具jad的应用的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/262381

相关文章

SpringMVC获取请求参数的方法

《SpringMVC获取请求参数的方法》:本文主要介绍SpringMVC获取请求参数的方法,本文通过实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下... 目录1、通过ServletAPI获取2、通过控制器方法的形参获取请求参数3、@RequestParam4、@

SpringShell命令行之交互式Shell应用开发方式

《SpringShell命令行之交互式Shell应用开发方式》本文将深入探讨SpringShell的核心特性、实现方式及应用场景,帮助开发者掌握这一强大工具,具有很好的参考价值,希望对大家有所帮助,如... 目录引言一、Spring Shell概述二、创建命令类三、命令参数处理四、命令分组与帮助系统五、自定

SpringBoot应用中出现的Full GC问题的场景与解决

《SpringBoot应用中出现的FullGC问题的场景与解决》这篇文章主要为大家详细介绍了SpringBoot应用中出现的FullGC问题的场景与解决方法,文中的示例代码讲解详细,感兴趣的小伙伴可... 目录Full GC的原理与触发条件原理触发条件对Spring Boot应用的影响示例代码优化建议结论F

基于Python打造一个全能文本处理工具

《基于Python打造一个全能文本处理工具》:本文主要介绍一个基于Python+Tkinter开发的全功能本地化文本处理工具,它不仅具备基础的格式转换功能,更集成了中文特色处理等实用功能,有需要的... 目录1. 概述:当文本处理遇上python图形界面2. 功能全景图:六大核心模块解析3.运行效果4. 相

springboot项目中常用的工具类和api详解

《springboot项目中常用的工具类和api详解》在SpringBoot项目中,开发者通常会依赖一些工具类和API来简化开发、提高效率,以下是一些常用的工具类及其典型应用场景,涵盖Spring原生... 目录1. Spring Framework 自带工具类(1) StringUtils(2) Coll

MySQL 分区与分库分表策略应用小结

《MySQL分区与分库分表策略应用小结》在大数据量、复杂查询和高并发的应用场景下,单一数据库往往难以满足性能和扩展性的要求,本文将详细介绍这两种策略的基本概念、实现方法及优缺点,并通过实际案例展示如... 目录mysql 分区与分库分表策略1. 数据库水平拆分的背景2. MySQL 分区策略2.1 分区概念

SpringBoot条件注解核心作用与使用场景详解

《SpringBoot条件注解核心作用与使用场景详解》SpringBoot的条件注解为开发者提供了强大的动态配置能力,理解其原理和适用场景是构建灵活、可扩展应用的关键,本文将系统梳理所有常用的条件注... 目录引言一、条件注解的核心机制二、SpringBoot内置条件注解详解1、@ConditionalOn

通过Spring层面进行事务回滚的实现

《通过Spring层面进行事务回滚的实现》本文主要介绍了通过Spring层面进行事务回滚的实现,包括声明式事务和编程式事务,具有一定的参考价值,感兴趣的可以了解一下... 目录声明式事务回滚:1. 基础注解配置2. 指定回滚异常类型3. ​不回滚特殊场景编程式事务回滚:1. ​使用 TransactionT

Spring LDAP目录服务的使用示例

《SpringLDAP目录服务的使用示例》本文主要介绍了SpringLDAP目录服务的使用示例... 目录引言一、Spring LDAP基础二、LdapTemplate详解三、LDAP对象映射四、基本LDAP操作4.1 查询操作4.2 添加操作4.3 修改操作4.4 删除操作五、认证与授权六、高级特性与最佳

Spring Shell 命令行实现交互式Shell应用开发

《SpringShell命令行实现交互式Shell应用开发》本文主要介绍了SpringShell命令行实现交互式Shell应用开发,能够帮助开发者快速构建功能丰富的命令行应用程序,具有一定的参考价... 目录引言一、Spring Shell概述二、创建命令类三、命令参数处理四、命令分组与帮助系统五、自定义S