Skip to content

Commit d3eba2a

Browse files
Merge branch 'skidfuscatordev:master' into master
2 parents e13f66f + af3594d commit d3eba2a

121 files changed

Lines changed: 12555 additions & 202 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitmodules

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[submodule "dev.xdark.ssvm"]
2+
url = git@github.com:terminalsin/SSVM.git

README.md

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,35 @@
2323
## 🚀 Quickstart
2424

2525
> [!TIP]
26-
> You can download Skidfuscator [here](https://github.com/skidfuscatordev/skidfuscator-java-obfuscator/releases) and run it directly using:
27-
> ```
28-
> java -jar skidfuscator.jar obfuscate <path to your jar>
26+
> If you are using Gradle, consider using our [Gradle plugin](https://github.com/skidfuscatordev/skidfuscator-gradle-plugin) for easy integration.
27+
> ```java
28+
> plugins {
29+
> id("io.github.skidfuscatordev.skidfuscator") version "0.1.3"
30+
> }
31+
>
32+
> skidfuscator {
33+
> // Configure the plugin here
34+
> skidfuscatorVersion = "latest"
35+
> exempt = ["com/example/SomeClass"]
36+
>
37+
> transformers {
38+
> interprocedural {
39+
> enabled = true
40+
> exempt = ["com/example/IgnoredClass"]
41+
> }
42+
> stringEncryption {
43+
> type = "STANDARD"
44+
> enabled = true
45+
> }
46+
> }
47+
>}
2948
> ```
3049
50+
You can download Skidfuscator [here](https://github.com/skidfuscatordev/skidfuscator-java-obfuscator/releases) and run it directly using:
51+
```
52+
java -jar skidfuscator.jar obfuscate <path to your jar>
53+
```
54+
3155
Skidfuscator uses a config system, which allows you to customize your obfuscation. We try to automatically download all compatible libraries, but some may slip through the cracks. The Gradle plugin is a work in progress. For now, use:
3256
```
3357
java -jar skidfuscator.jar obfuscate <path to your jar> -li=<path to folder with all libs>
@@ -67,8 +91,14 @@ Skidfuscator intelligently identifies and downloads missing dependencies needed
6791
6892
### 2. Smart Recovery
6993
In the event of errors or failed obfuscation, Skidfuscator implements a recovery system that intelligently resolves conflicts and provides suggestions to fix issues. This ensures minimal disruption in your development workflow.
94+
95+
![FocuSee_Project_2024-12-18_03-32-25-ezgif com-optimize (1)](https://github.com/user-attachments/assets/af709b36-1031-4519-8e21-2ec63a245ffb)
96+
7097
### 3. Auto Configuration
7198
Skidfuscator comes with built-in presets for common configurations, allowing quick setup without needing to manually tweak every aspect of the obfuscation process. For advanced users, all settings remain fully customizable.
99+
100+
![FocuSeeProject2024-12-1802-56-07-ezgif com-optimize](https://github.com/user-attachments/assets/591415a0-b8fe-46d6-a530-d7914c58f613)
101+
72102
### 4. Flow Obfuscation (GEN3)
73103
Skidfuscator introduces third-generation control flow obfuscation (Flow GEN3), which scrambles method logic and makes the control flow harder to understand. This method introduces opaque predicates and complex flow redirections, hindering static and dynamic analysis.
74104
### 5. Advanced Obfuscation Methods

SSVM

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 0d4fc5417a8a21b58dcd29849dac013aa00b4817

build.gradle

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ allprojects {
1111
maven {
1212
url 'https://repo.cleanroommc.com/releases/'
1313
}
14+
maven {
15+
url 'https://jitpack.io'
16+
}
1417
}
1518

1619
apply plugin: 'java'
@@ -20,8 +23,8 @@ allprojects {
2023
targetCompatibility = 1.8
2124

2225
dependencies {
23-
compileOnly 'org.projectlombok:lombok:1.18.24'
24-
annotationProcessor 'org.projectlombok:lombok:1.18.24'
26+
compileOnly 'org.projectlombok:lombok:1.18.36'
27+
annotationProcessor 'org.projectlombok:lombok:1.18.36'
2528

2629
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.0'
2730
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.0'
@@ -30,6 +33,15 @@ allprojects {
3033
compileJava {
3134
options.encoding = "UTF-8" // Will fail on the non-ascii comments if not set
3235
}
36+
37+
ext {
38+
asm = 'org.ow2.asm:asm:9.7.1'
39+
asm_commons = 'org.ow2.asm:asm-commons:9.7.1'
40+
asm_tree = 'org.ow2.asm:asm-tree:9.7.1'
41+
cafedude = 'com.github.Col-E:CAFED00D:2.1.1'
42+
slf4j_api = 'org.slf4j:slf4j-api:1.7.36'
43+
jlinker = 'com.github.xxDark:jlinker:1.0.7'
44+
}
3345
}
3446

3547
group 'dev.skidfuscator.community'

dev.skidfuscator.client.standalone/build.gradle

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
plugins {
22
id 'com.github.johnrengelman.shadow' version '7.1.2'
33
id 'application'
4+
id 'xyz.wagyourtail.jvmdowngrader' version '1.2.1'
45
}
56
repositories {
67
mavenCentral()
@@ -11,11 +12,21 @@ application {
1112
mainClass = 'dev.skidfuscator.obfuscator.SkidfuscatorMain'
1213
}
1314

15+
downgradeJar {
16+
downgradeTo = JavaVersion.VERSION_1_8
17+
}
18+
19+
shadeDowngradedApi {
20+
downgradeTo = JavaVersion.VERSION_1_8
21+
}
22+
1423
dependencies {
1524
implementation 'info.picocli:picocli:4.6.3'
1625
implementation 'org.jline:jline:3.21.0'
1726
implementation 'com.jgoodies:jgoodies-forms:1.9.0'
1827
implementation 'com.github.vlsi.mxgraph:jgraphx:4.2.2'
28+
implementation 'com.formdev:flatlaf:3.5.4'
29+
implementation 'com.formdev:flatlaf-intellij-themes:3.5.4'
1930

2031
implementation project(':obfuscator')
2132

@@ -25,4 +36,7 @@ dependencies {
2536

2637
test {
2738
useJUnitPlatform()
28-
}
39+
}
40+
41+
sourceCompatibility = JavaVersion.VERSION_17
42+
targetCompatibility = JavaVersion.VERSION_17
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
exempt=[
2+
"class{^(?!(dev\\/skidfuscator)).*$}",
3+
"class{^jghost\\/}",
4+
"class{Dump}",
5+
"class{FrameComputer}",
6+
"class{util}",
7+
"class{PredicateFactory}"
8+
]
9+
flowCondition {
10+
enabled=true
11+
}
12+
flowException {
13+
enabled=true
14+
strength=AGGRESSIVE
15+
}
16+
flowRange {
17+
enabled=true
18+
}
19+
native {
20+
enabled=false
21+
}
22+
numberEncryption {
23+
enabled=true
24+
}
25+
stringEncryption {
26+
enabled=true
27+
type=STANDARD
28+
}

dev.skidfuscator.client.standalone/src/main/java/dev/skidfuscator/obfuscator/SkidfuscatorMain.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package dev.skidfuscator.obfuscator;
22

3+
import com.formdev.flatlaf.intellijthemes.FlatDarkPurpleIJTheme;
34
import dev.skidfuscator.obfuscator.command.HelpCommand;
45
import dev.skidfuscator.obfuscator.command.MappingsCommand;
56
import dev.skidfuscator.obfuscator.command.ObfuscateCommand;
7+
import dev.skidfuscator.obfuscator.gui.MainFrame;
68
import dev.skidfuscator.obfuscator.util.LogoUtil;
79
import lombok.SneakyThrows;
810
import org.jline.reader.EndOfFileException;
@@ -13,13 +15,31 @@
1315
import org.jline.terminal.TerminalBuilder;
1416
import picocli.CommandLine;
1517

18+
import javax.swing.*;
1619
import java.io.File;
1720

1821
public class SkidfuscatorMain {
1922

2023
@SneakyThrows
2124
public static void main(String[] args) {
2225

26+
if (args.length == 0) {
27+
// MacOS menu bar
28+
System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Skidfuscator");
29+
System.setProperty("apple.laf.useScreenMenuBar", "true");
30+
SwingUtilities.invokeLater(() -> {
31+
try {
32+
FlatDarkPurpleIJTheme.setup();
33+
} catch (Exception e) {
34+
e.printStackTrace();
35+
}
36+
new MainFrame().setVisible(true);
37+
});
38+
return;
39+
}
40+
41+
LogoUtil.printLogo();
42+
2343
if (args.length == 1 && args[0].equalsIgnoreCase("cli")) {
2444
final LineReader reader = LineReaderBuilder
2545
.builder()
@@ -72,7 +92,6 @@ public static void main(String[] args) {
7292
}
7393

7494
} else {
75-
LogoUtil.printLogo();
7695
new CommandLine(new HelpCommand())
7796
.addSubcommand("obfuscate", new ObfuscateCommand())
7897
.addSubcommand("mappings", new MappingsCommand())

dev.skidfuscator.client.standalone/src/main/java/dev/skidfuscator/obfuscator/command/ObfuscateCommand.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,61 +31,61 @@ public class ObfuscateCommand implements Callable<Integer> {
3131
index = "0",
3232
description = "The file which will be obfuscated."
3333
)
34-
private File input;
34+
public File input;
3535

3636
@CommandLine.Option(
3737
names = {"-rt", "--runtime"},
3838
description = "Path to the runtime jar"
3939
)
40-
private File runtime;
40+
public File runtime;
4141

4242
@CommandLine.Option(
4343
names = {"-li", "--libs"},
4444
description = "Path to the libs folder"
4545
)
46-
private File libFolder;
46+
public File libFolder;
4747

4848
@CommandLine.Option(
4949
names = {"-ex", "--exempt"},
5050
description = "Path to the exempt file"
5151
)
52-
private File exempt;
52+
public File exempt;
5353

5454
@CommandLine.Option(
5555
names = {"-o", "--output"},
5656
description = "Path to the output jar location"
5757
)
58-
private File output;
58+
public File output;
5959

6060
@CommandLine.Option(
6161
names = {"-cfg", "--config"},
6262
description = "Path to the config file"
6363
)
64-
private File config;
64+
public File config;
6565

6666
@CommandLine.Option(
6767
names = {"-ph", "--phantom"},
6868
description = "Declare if phantom computation should be used"
6969
)
70-
private boolean phantom;
70+
public boolean phantom;
7171

7272
@CommandLine.Option(
7373
names = {"-fuckit", "--fuckit"},
7474
description = "Do not use!"
7575
)
76-
private boolean fuckit;
76+
public boolean fuckit;
7777

7878
@CommandLine.Option(
7979
names = {"-dbg", "--debug"},
8080
description = "Do not use!"
8181
)
82-
private boolean debug;
82+
public boolean debug;
8383

8484
@CommandLine.Option(
8585
names = {"-notrack", "--notrack"},
8686
description = "If you do not wish to be part of analytics!"
8787
)
88-
private boolean notrack;
88+
public boolean notrack;
8989

9090

9191
@Override
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
package dev.skidfuscator.obfuscator.config;
2+
3+
import com.typesafe.config.*;
4+
import java.util.*;
5+
import java.util.stream.Collectors;
6+
7+
/**
8+
* Configuration generator for Skidfuscator transformers.
9+
* Handles HOCON configuration generation using Lightbend Config library.
10+
*/
11+
public class SkidfuscatorConfig {
12+
private final Map<String, ConfigValue> configMap = new HashMap<>();
13+
14+
/**
15+
* Adds a transformer configuration block.
16+
* @param name Transformer name
17+
* @param enabled Enabled state
18+
* @param options Additional transformer options
19+
* @param exemptions List of exemption patterns
20+
*/
21+
public void addTransformer(String name, boolean enabled, Map<String, Object> options, List<String> exemptions) {
22+
Map<String, Object> transformerConfig = new HashMap<>();
23+
transformerConfig.put("enabled", enabled);
24+
25+
if (options != null && !options.isEmpty()) {
26+
transformerConfig.putAll(options);
27+
}
28+
29+
if (exemptions != null && !exemptions.isEmpty()) {
30+
transformerConfig.put("exempt", exemptions);
31+
}
32+
33+
configMap.put(name, ConfigValueFactory.fromMap(transformerConfig));
34+
}
35+
36+
/**
37+
* Sets global exemptions for the obfuscator.
38+
* @param exemptions List of global exemption patterns
39+
*/
40+
public void setGlobalExemptions(List<String> exemptions) {
41+
if (exemptions != null && !exemptions.isEmpty()) {
42+
configMap.put("exempt", ConfigValueFactory.fromIterable(exemptions));
43+
}
44+
}
45+
46+
/**
47+
* Sets library dependencies for the obfuscator.
48+
* @param libraries List of library paths
49+
*/
50+
public void setLibraries(List<String> libraries) {
51+
if (libraries != null && !libraries.isEmpty()) {
52+
configMap.put("libraries", ConfigValueFactory.fromIterable(libraries));
53+
}
54+
}
55+
56+
/**
57+
* Generates the final Config object.
58+
* @return Config object containing all settings
59+
*/
60+
public Config generateConfig() {
61+
return ConfigFactory.parseMap(configMap);
62+
}
63+
64+
/**
65+
* Renders the configuration as a HOCON string.
66+
* @return Formatted HOCON configuration string
67+
*/
68+
public String renderConfig() {
69+
return generateConfig().root().render(
70+
ConfigRenderOptions.defaults()
71+
.setOriginComments(false)
72+
.setComments(true)
73+
.setFormatted(true)
74+
.setJson(false)
75+
);
76+
}
77+
}

0 commit comments

Comments
 (0)