环境说明
1、win10
2、JAVA8(环境变量要配置好)
3、cfr版本:C:\Users(xx)当前用户\cfr-0.152.jar
4、命令行操作路径:C:\Users(xx)当前用户
5、示例反编译jar包:C:\Users(xx)当前用户\ruoyi-admin.jar
CFR工具相关参数
- 查看所有参数
C:\Users\赵亮>java -jar cfr-0.152.jar ruoyi-admin.jar --help
CFR 0.152
--aexagg (boolean)
--aexagg2 (boolean)
--aggressivedocopy (int >= 0) default: 0
--aggressivedoextension (boolean)
--aggressiveduff (boolean)
--aggressivesizethreshold (int >= 0) default: 13000
--allowcorrecting (boolean) default: true
--allowmalformedswitch (boolean)
--analyseas (One of [DETECT, JAR, WAR, CLASS])
--antiobf (boolean) default: false
--arrayiter (boolean) default: true if class file from version 49.0 (Java 5) or greater
--caseinsensitivefs (boolean) default: true
--clobber (boolean)
--collectioniter (boolean) default: true if class file from version 49.0 (Java 5) or greater
--commentmonitors (boolean) default: false
--comments (boolean) default: true
--constobf (boolean) default: Value of option 'antiobf'
--decodeenumswitch (boolean) default: true if class file from version 49.0 (Java 5) or greater
--decodefinally (boolean) default: true
--decodelambdas (boolean) default: true if class file from version 52.0 (Java 8) or greater
--decodestringswitch (boolean) default: true if class file from version 51.0 (Java 7) or greater
--dumpclasspath (boolean) default: false
--eclipse (boolean) default: true
--elidescala (boolean) default: false
--extraclasspath (string)
--forbidanonymousclasses (boolean) default: false
--forbidmethodscopedclasses (boolean) default: false
--forceclassfilever (string, specifying either java version as 'j6', 'j1.0', or classfile as '56', '56.65535')
--forcecondpropagate (boolean)
--forceexceptionprune (boolean)
--forcereturningifs (boolean)
--forcetopsort (boolean)
--forcetopsortaggress (boolean)
--forcetopsortnopull (boolean)
--forloopaggcapture (boolean)
--hidebridgemethods (boolean) default: Value of option 'obfattr'
--hidelangimports (boolean) default: true
--hidelongstrings (boolean) default: false
--hideutf (boolean) default: true
--ignoreexceptions (boolean) default: false
--ignoreexceptionsalways (boolean) default: false
--importfilter (string)
--innerclasses (boolean) default: true
--instanceofpattern (boolean) default: true if class file from version 60.0 (Java 16) or greater, or experimental in 58.0 (Java 14), 59.0 (Java 15)
--j14classobj (boolean) default: false if class file from version 49.0 (Java 5) or greater
--jarfilter (string)
--labelledblocks (boolean) default: true
--lenient (boolean) default: false
--liftconstructorinit (boolean) default: true
--lomem (boolean) default: false
--methodname (string)
--obfattr (boolean) default: Value of option 'antiobf'
--obfcontrol (boolean) default: Value of option 'antiobf'
--obfuscationpath (string)
--outputdir (string)
--outputencoding (string)
--outputpath (string)
--override (boolean) default: true if class file from version 50.0 (Java 6) or greater
--previewfeatures (boolean) default: true
--pullcodecase (boolean) default: false
--recordtypes (boolean) default: true if class file from version 60.0 (Java 16) or greater, or experimental in 58.0 (Java 14), 59.0 (Java 15)
--recover (boolean) default: true
--recovertypeclash (boolean)
--recovertypehints (boolean)
--reducecondscope (boolean)
--relinkconst (boolean) default: true
--relinkconststring (boolean) default: Value of option 'relinkconst'
--removebadgenerics (boolean) default: true
--removeboilerplate (boolean) default: true
--removedeadconditionals (boolean)
--removedeadmethods (boolean) default: true
--removeinnerclasssynthetics (boolean) default: true
--rename (boolean) default: false
--renamedupmembers (boolean) default: Value of option 'rename'
--renameenumidents (boolean) default: Value of option 'rename'
--renameillegalidents (boolean) default: Value of option 'rename'
--renamesmallmembers (int >= 0) default: 0
--sealed (boolean) default: true if class file from version 62.0 (Java 18) or greater, or experimental in 60.0 (Java 16), 61.0 (Java 17)
--showinferrable (boolean) default: false if class file from version 51.0 (Java 7) or greater
--showversion (boolean) default: true
--silent (boolean) default: false
--skipbatchinnerclasses (boolean) default: true
--staticinitreturn (boolean) default: true
--stringbuffer (boolean) default: false if class file from version 49.0 (Java 5) or greater
--stringbuilder (boolean) default: true if class file from version 49.0 (Java 5) or greater
--stringconcat (boolean) default: true if class file from version 53.0 (Java 9) or greater
--sugarasserts (boolean) default: true
--sugarboxing (boolean) default: true
--sugarenums (boolean) default: true if class file from version 49.0 (Java 5) or greater
--sugarretrolambda (boolean) default: false
--switchexpression (boolean) default: true if class file from version 58.0 (Java 14) or greater, or experimental in 56.0 (Java 12), 57.0 (Java 13)
--tidymonitors (boolean) default: true
--trackbytecodeloc (boolean) default: false
--tryresources (boolean) default: true if class file from version 51.0 (Java 7) or greater
--usenametable (boolean) default: true
--usesignatures (boolean) default: true
--version (boolean) default: true
--help (string)
- 查看某个具体参数的说明-以我用到的outputdir为例
C:\Users\赵亮>java -jar cfr-0.152.jar ruoyi-admin.jar --help outputdir
CFR 0.152
'outputdir':
Decompile to files in [directory] (= options 'outputpath' + 'clobber') (historic compatibility)
解释:反编译为[directory]中的文件(='outputpath'+'clober')(历史兼容性)
Range : string
class单个反编译
C:\Users\赵亮>java -jar cfr-0.152.jar C:\Users\赵亮\ruoyi-admin\BOOT-INF\classes\com\ruoyi\web\controller\common\CaptchaController.class
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.google.code.kaptcha.Producer
* com.ruoyi.common.config.RuoYiConfig
* com.ruoyi.common.constant.Constants
* com.ruoyi.common.core.domain.AjaxResult
* com.ruoyi.common.core.redis.RedisCache
* com.ruoyi.common.utils.sign.Base64
* com.ruoyi.common.utils.uuid.IdUtils
* com.ruoyi.system.service.ISysConfigService
* javax.servlet.http.HttpServletResponse
* org.springframework.beans.factory.annotation.Autowired
* org.springframework.util.FastByteArrayOutputStream
* org.springframework.web.bind.annotation.GetMapping
* org.springframework.web.bind.annotation.RestController
*/
package com.ruoyi.web.controller.common;
import com.google.code.kaptcha.Producer;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.sign.Base64;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.system.service.ISysConfigService;
import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
import java.io.IOException;
import java.io.OutputStream;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.FastByteArrayOutputStream;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class CaptchaController {
@Resource(name="captchaProducer")
private Producer captchaProducer;
@Resource(name="captchaProducerMath")
private Producer captchaProducerMath;
@Autowired
private RedisCache redisCache;
@Autowired
private ISysConfigService configService;
@GetMapping(value={"/captchaImage"})
public AjaxResult getCode(HttpServletResponse response) throws IOException {
AjaxResult ajax = AjaxResult.success();
boolean captchaOnOff = this.configService.selectCaptchaOnOff();
ajax.put("captchaOnOff", (Object)captchaOnOff);
if (!captchaOnOff) {
return ajax;
}
String uuid = IdUtils.simpleUUID();
String verifyKey = "captcha_codes:" + uuid;
String capStr = null;
String code = null;
BufferedImage image = null;
String captchaType = RuoYiConfig.getCaptchaType();
if ("math".equals(captchaType)) {
String capText = this.captchaProducerMath.createText();
capStr = capText.substring(0, capText.lastIndexOf("@"));
code = capText.substring(capText.lastIndexOf("@") + 1);
image = this.captchaProducerMath.createImage(capStr);
} else if ("char".equals(captchaType)) {
capStr = code = this.captchaProducer.createText();
image = this.captchaProducer.createImage(capStr);
}
this.redisCache.setCacheObject(verifyKey, (Object)code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
FastByteArrayOutputStream os = new FastByteArrayOutputStream();
try {
ImageIO.write((RenderedImage)image, "jpg", (OutputStream)os);
}
catch (IOException e) {
return AjaxResult.error((String)e.getMessage());
}
ajax.put("uuid", (Object)uuid);
ajax.put("img", (Object)Base64.encode((byte[])os.toByteArray()));
return ajax;
}
}
C:\Users\赵亮>
jar包整体反编译
- 反编译并且输出到当前路径target文件夹下
java -jar cfr-0.152.jar ruoyi-admin.jar --outputdir target
结果截图:
为方便大家测试已经将cfr-0.152.jar共享:
https://www.alipan.com/s/vkVThap1KiM
提取码: sg99
点击链接保存,或者复制本段内容,打开「阿里云盘」APP ,无需下载极速在线查看,视频原画倍速播放。