Skip to content

Commit

Permalink
Merge branch 'skidfuscatordev:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
anjeshshrestha authored Dec 23, 2024
2 parents e13f66f + af3594d commit d3eba2a
Show file tree
Hide file tree
Showing 121 changed files with 12,555 additions and 202 deletions.
2 changes: 2 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[submodule "dev.xdark.ssvm"]
url = [email protected]:terminalsin/SSVM.git
36 changes: 33 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,35 @@
## 🚀 Quickstart

> [!TIP]
> You can download Skidfuscator [here](https://github.com/skidfuscatordev/skidfuscator-java-obfuscator/releases) and run it directly using:
> ```
> java -jar skidfuscator.jar obfuscate <path to your jar>
> If you are using Gradle, consider using our [Gradle plugin](https://github.com/skidfuscatordev/skidfuscator-gradle-plugin) for easy integration.
> ```java
> plugins {
> id("io.github.skidfuscatordev.skidfuscator") version "0.1.3"
> }
>
> skidfuscator {
> // Configure the plugin here
> skidfuscatorVersion = "latest"
> exempt = ["com/example/SomeClass"]
>
> transformers {
> interprocedural {
> enabled = true
> exempt = ["com/example/IgnoredClass"]
> }
> stringEncryption {
> type = "STANDARD"
> enabled = true
> }
> }
>}
> ```
You can download Skidfuscator [here](https://github.com/skidfuscatordev/skidfuscator-java-obfuscator/releases) and run it directly using:
```
java -jar skidfuscator.jar obfuscate <path to your jar>
```
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:
```
java -jar skidfuscator.jar obfuscate <path to your jar> -li=<path to folder with all libs>
Expand Down Expand Up @@ -67,8 +91,14 @@ Skidfuscator intelligently identifies and downloads missing dependencies needed
### 2. Smart Recovery
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.
![FocuSee_Project_2024-12-18_03-32-25-ezgif com-optimize (1)](https://github.com/user-attachments/assets/af709b36-1031-4519-8e21-2ec63a245ffb)
### 3. Auto Configuration
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.
![FocuSeeProject2024-12-1802-56-07-ezgif com-optimize](https://github.com/user-attachments/assets/591415a0-b8fe-46d6-a530-d7914c58f613)
### 4. Flow Obfuscation (GEN3)
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.
### 5. Advanced Obfuscation Methods
Expand Down
1 change: 1 addition & 0 deletions SSVM
Submodule SSVM added at 0d4fc5
16 changes: 14 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ allprojects {
maven {
url 'https://repo.cleanroommc.com/releases/'
}
maven {
url 'https://jitpack.io'
}
}

apply plugin: 'java'
Expand All @@ -20,8 +23,8 @@ allprojects {
targetCompatibility = 1.8

dependencies {
compileOnly 'org.projectlombok:lombok:1.18.24'
annotationProcessor 'org.projectlombok:lombok:1.18.24'
compileOnly 'org.projectlombok:lombok:1.18.36'
annotationProcessor 'org.projectlombok:lombok:1.18.36'

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.0'
Expand All @@ -30,6 +33,15 @@ allprojects {
compileJava {
options.encoding = "UTF-8" // Will fail on the non-ascii comments if not set
}

ext {
asm = 'org.ow2.asm:asm:9.7.1'
asm_commons = 'org.ow2.asm:asm-commons:9.7.1'
asm_tree = 'org.ow2.asm:asm-tree:9.7.1'
cafedude = 'com.github.Col-E:CAFED00D:2.1.1'
slf4j_api = 'org.slf4j:slf4j-api:1.7.36'
jlinker = 'com.github.xxDark:jlinker:1.0.7'
}
}

group 'dev.skidfuscator.community'
Expand Down
16 changes: 15 additions & 1 deletion dev.skidfuscator.client.standalone/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'application'
id 'xyz.wagyourtail.jvmdowngrader' version '1.2.1'
}
repositories {
mavenCentral()
Expand All @@ -11,11 +12,21 @@ application {
mainClass = 'dev.skidfuscator.obfuscator.SkidfuscatorMain'
}

downgradeJar {
downgradeTo = JavaVersion.VERSION_1_8
}

shadeDowngradedApi {
downgradeTo = JavaVersion.VERSION_1_8
}

dependencies {
implementation 'info.picocli:picocli:4.6.3'
implementation 'org.jline:jline:3.21.0'
implementation 'com.jgoodies:jgoodies-forms:1.9.0'
implementation 'com.github.vlsi.mxgraph:jgraphx:4.2.2'
implementation 'com.formdev:flatlaf:3.5.4'
implementation 'com.formdev:flatlaf-intellij-themes:3.5.4'

implementation project(':obfuscator')

Expand All @@ -25,4 +36,7 @@ dependencies {

test {
useJUnitPlatform()
}
}

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
28 changes: 28 additions & 0 deletions dev.skidfuscator.client.standalone/skidfuscator-config.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
exempt=[
"class{^(?!(dev\\/skidfuscator)).*$}",
"class{^jghost\\/}",
"class{Dump}",
"class{FrameComputer}",
"class{util}",
"class{PredicateFactory}"
]
flowCondition {
enabled=true
}
flowException {
enabled=true
strength=AGGRESSIVE
}
flowRange {
enabled=true
}
native {
enabled=false
}
numberEncryption {
enabled=true
}
stringEncryption {
enabled=true
type=STANDARD
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package dev.skidfuscator.obfuscator;

import com.formdev.flatlaf.intellijthemes.FlatDarkPurpleIJTheme;
import dev.skidfuscator.obfuscator.command.HelpCommand;
import dev.skidfuscator.obfuscator.command.MappingsCommand;
import dev.skidfuscator.obfuscator.command.ObfuscateCommand;
import dev.skidfuscator.obfuscator.gui.MainFrame;
import dev.skidfuscator.obfuscator.util.LogoUtil;
import lombok.SneakyThrows;
import org.jline.reader.EndOfFileException;
Expand All @@ -13,13 +15,31 @@
import org.jline.terminal.TerminalBuilder;
import picocli.CommandLine;

import javax.swing.*;
import java.io.File;

public class SkidfuscatorMain {

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

if (args.length == 0) {
// MacOS menu bar
System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Skidfuscator");
System.setProperty("apple.laf.useScreenMenuBar", "true");
SwingUtilities.invokeLater(() -> {
try {
FlatDarkPurpleIJTheme.setup();
} catch (Exception e) {
e.printStackTrace();
}
new MainFrame().setVisible(true);
});
return;
}

LogoUtil.printLogo();

if (args.length == 1 && args[0].equalsIgnoreCase("cli")) {
final LineReader reader = LineReaderBuilder
.builder()
Expand Down Expand Up @@ -72,7 +92,6 @@ public static void main(String[] args) {
}

} else {
LogoUtil.printLogo();
new CommandLine(new HelpCommand())
.addSubcommand("obfuscate", new ObfuscateCommand())
.addSubcommand("mappings", new MappingsCommand())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,61 +31,61 @@ public class ObfuscateCommand implements Callable<Integer> {
index = "0",
description = "The file which will be obfuscated."
)
private File input;
public File input;

@CommandLine.Option(
names = {"-rt", "--runtime"},
description = "Path to the runtime jar"
)
private File runtime;
public File runtime;

@CommandLine.Option(
names = {"-li", "--libs"},
description = "Path to the libs folder"
)
private File libFolder;
public File libFolder;

@CommandLine.Option(
names = {"-ex", "--exempt"},
description = "Path to the exempt file"
)
private File exempt;
public File exempt;

@CommandLine.Option(
names = {"-o", "--output"},
description = "Path to the output jar location"
)
private File output;
public File output;

@CommandLine.Option(
names = {"-cfg", "--config"},
description = "Path to the config file"
)
private File config;
public File config;

@CommandLine.Option(
names = {"-ph", "--phantom"},
description = "Declare if phantom computation should be used"
)
private boolean phantom;
public boolean phantom;

@CommandLine.Option(
names = {"-fuckit", "--fuckit"},
description = "Do not use!"
)
private boolean fuckit;
public boolean fuckit;

@CommandLine.Option(
names = {"-dbg", "--debug"},
description = "Do not use!"
)
private boolean debug;
public boolean debug;

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


@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package dev.skidfuscator.obfuscator.config;

import com.typesafe.config.*;
import java.util.*;
import java.util.stream.Collectors;

/**
* Configuration generator for Skidfuscator transformers.
* Handles HOCON configuration generation using Lightbend Config library.
*/
public class SkidfuscatorConfig {
private final Map<String, ConfigValue> configMap = new HashMap<>();

/**
* Adds a transformer configuration block.
* @param name Transformer name
* @param enabled Enabled state
* @param options Additional transformer options
* @param exemptions List of exemption patterns
*/
public void addTransformer(String name, boolean enabled, Map<String, Object> options, List<String> exemptions) {
Map<String, Object> transformerConfig = new HashMap<>();
transformerConfig.put("enabled", enabled);

if (options != null && !options.isEmpty()) {
transformerConfig.putAll(options);
}

if (exemptions != null && !exemptions.isEmpty()) {
transformerConfig.put("exempt", exemptions);
}

configMap.put(name, ConfigValueFactory.fromMap(transformerConfig));
}

/**
* Sets global exemptions for the obfuscator.
* @param exemptions List of global exemption patterns
*/
public void setGlobalExemptions(List<String> exemptions) {
if (exemptions != null && !exemptions.isEmpty()) {
configMap.put("exempt", ConfigValueFactory.fromIterable(exemptions));
}
}

/**
* Sets library dependencies for the obfuscator.
* @param libraries List of library paths
*/
public void setLibraries(List<String> libraries) {
if (libraries != null && !libraries.isEmpty()) {
configMap.put("libraries", ConfigValueFactory.fromIterable(libraries));
}
}

/**
* Generates the final Config object.
* @return Config object containing all settings
*/
public Config generateConfig() {
return ConfigFactory.parseMap(configMap);
}

/**
* Renders the configuration as a HOCON string.
* @return Formatted HOCON configuration string
*/
public String renderConfig() {
return generateConfig().root().render(
ConfigRenderOptions.defaults()
.setOriginComments(false)
.setComments(true)
.setFormatted(true)
.setJson(false)
);
}
}
Loading

0 comments on commit d3eba2a

Please sign in to comment.