Skip to content

Commit

Permalink
release 1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
4ra1n committed Dec 10, 2024
1 parent a3d24d4 commit 0f9f711
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:

env:
VERSION: "1.1.0"
VERSION: "1.1.1"

jobs:

Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# CHANGELOG

## 1.1.1

更新日志:

- [BUG] 修复 `API` 调用多次报错的问题

感谢以下用户的贡献:

- 4ra1n (https://github.com/4ra1n)

可供下载的文件都由 `Github Actions` 构建,使用 `java -jar class-obf.jar` 启动

## 1.1.0

更新日志:
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>me.n1ar4</groupId>
<artifactId>class-obf</artifactId>
<version>1.1.0</version>
<version>1.1.1</version>

<packaging>jar</packaging>
<description>Class Obfuscator Project</description>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/me/n1ar4/clazz/obfuscator/Const.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.nio.file.Paths;

public interface Const {
String VERSION = "1.1.0";
String VERSION = "1.1.1";
String PROJECT_URL = "https://github.com/jar-analyzer/class-obf";
Path configPath = Paths.get("config.yaml");
Path TEMP_PATH = Paths.get("class-obf-temp.class");
Expand Down
30 changes: 28 additions & 2 deletions src/main/java/me/n1ar4/clazz/obfuscator/api/ClassObf.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import me.n1ar4.clazz.obfuscator.config.BaseConfig;
import me.n1ar4.clazz.obfuscator.config.Manager;
import me.n1ar4.clazz.obfuscator.core.AnalyzeEnv;
import me.n1ar4.clazz.obfuscator.core.ObfEnv;
import me.n1ar4.clazz.obfuscator.core.Runner;
import me.n1ar4.clazz.obfuscator.utils.FileUtil;
import me.n1ar4.jrandom.core.JRandom;
Expand Down Expand Up @@ -42,9 +44,8 @@ public Result run(String path) {

// 重载 - 支持输入 byte[] 字节码
public Result run(byte[] input) {
String randomInputFile = JRandom.getInstance().randomString(16);
try {
Path inputPath = Paths.get(randomInputFile + ".class");
Path inputPath = Files.createTempFile("class-obf", ".class");
Files.write(inputPath, input);
Result result = run(inputPath);
if (result.getMessage().equals(Result.SUCCESS)) {
Expand All @@ -61,6 +62,7 @@ public Result run(byte[] input) {
// 重载 - 支持输入 PATH
public Result run(Path path) {
try {
clean();
Manager.initConfig(this.config);
Runner.run(path, this.config);
String fileName = FileUtil.getFileNameWithoutExt(path);
Expand All @@ -80,4 +82,28 @@ public Result run(Path path) {
return Result.Error(ex.getMessage());
}
}

private void clean() {
AnalyzeEnv.classFileList.clear();

AnalyzeEnv.discoveredClasses.clear();
AnalyzeEnv.discoveredMethods.clear();

AnalyzeEnv.classMap.clear();
AnalyzeEnv.methodMap.clear();

AnalyzeEnv.methodCalls.clear();
AnalyzeEnv.methodsInClassMap.clear();

AnalyzeEnv.fieldsInClassMap.clear();

ObfEnv.stringInClass.clear();
ObfEnv.newStringInClass.clear();

ObfEnv.methodNameObfMapping.clear();
ObfEnv.fieldNameObfMapping.clear();

ObfEnv.config = new BaseConfig();
ObfEnv.ADVANCE_STRING_NAME = null;
}
}

0 comments on commit 0f9f711

Please sign in to comment.