Obfuscation in java code

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

License

superblaubeere27/obfuscator

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

* Add flatlaf. Change form main panels margins to improve visuals * Add flatlaf. Change form main panels margins to improve visuals * Add flatlaf Change panels margins to improve visuals Change windows size to default instead of basing it of a calculation from screensize. Change scripting field to top/left with fill. * Add flatlaf Change panels margins to improve visuals Change windows size to default instead of basing it of a calculation from screensize. Change scripting field to top/left with fill. * Add flatlaf Change panels margins to improve visuals Change windows size to default instead of basing it of a calculation from screensize. Change scripting field to top/left with fill.

Git stats

Files

Failed to load latest commit information.

README.md

If you are interested in stronger obfuscation methods, feel free to take a look at my new project masxinlingvonta that further obfuscates java bytecode by compiling it to native code.

A Java bytecode obfuscator supporting

  • Flow Obfuscation
  • Line Number Removal
  • Number Obfuscation
  • [Unstable] Name Obfuscation (Classes, methods and fields) with custom dictionaries
  • Deobfuscator crasher
  • String Encryption
  • Inner Class Removal
  • HWID Locking
  • Invoke Dynamic
  • Reference Proxy
  • Member Shuffling & Hiding

Feel free to join my discord server:

public class HelloWorld < public HelloWorld() < super(); > public static void main(final String[] args) < System.out.println("Hello World"); for (int i = 0; i < 10; ++i) < System.out.println(i); > > >

Obfuscated (short version for full code visit https://pastebin.com/RFHtgPtX)

public class HelloWorld < public static void main(final String[] array) < // invokedynamic(1:(Ljava/io/PrintStream;Ljava/lang/String;)V, invokedynamic(0:()Ljava/io/PrintStream;), HelloWorld.llII[HelloWorld.lllI[0]]) float lllllllIlIllIII = HelloWorld.lllI[0]; while (llIll((int)lllllllIlIllIII, HelloWorld.lllI[1])) < // invokedynamic(2:(Ljava/io/PrintStream;I)V, invokedynamic(0:()Ljava/io/PrintStream;), lllllllIlIllIII) ++lllllllIlIllIII; "".length(); if (" ".length() == (" ".length() " ".length() " ".length()) & ~(" ".length() " ".length() " ".length())))) < throw null; > > > >

—help Prints the help page on the screen

—version Shows the version of the obfuscator

—scriptFile A JS file to script certain parts of the obfuscation

—threads Sets the number of threads the obfuscator should use

—verbose Sets logging to verbose mode

java -jar obfuscator.jar —jarIn helloWorld.jar —jarOut helloWorld-obf.jar

java -jar obfuscator.jar —jarIn helloWorld.jar —jarOut helloWorld-obf.jar —config obfConfig

< "input": "D:\\Computing\\HelloWorld\\out\\artifacts\\HelloWorld_jar\\HelloWorld.jar", "output": "D:\\Computing\\HelloWorld\\out\\artifacts\\HelloWorld_jar\\HelloWorld-obf.jar", "script": "function isRemappingEnabledForClass(node) \nfunction isObfuscatorEnabledForClass(node) ", "libraries": [ "C:\\Program Files\\Java\\jre1.8.0_211\\lib", "D:\\Computing\\backdoored_old\\dependencies", "D:\\Computing\\backdoored\\libs" ], "Crasher": < "Enabled": false, "Invalid Signatures": true, "Empty annotation spam": true >, "InvokeDynamic": < "Enabled": true >, "HWIDPRotection": < "Enabled": false, "HWID": "" >, "Optimizer": < "Enabled": true, "Replace String.equals()": true, "Replace String.equalsIgnoreCase()": true, "Optimize static string calls": true >, "LineNumberRemover": < "Enabled": true, "Rename local variables": true, "Remove Line Numbers": true, "Remove Debug Names": true, "Add Local Variables": true, "New SourceFile Name": "" >, "StringEncryption": < "Enabled": true, "HideStrings": true, "AES": true >, "NumberObfuscation": < "Enabled": true, "Extract to Array": true, "Obfuscate Zero": true, "Shift": false, "And": false, "Multiple Instructions": true >, "ReferenceProxy": < "Enabled": false >, "ShuffleMembers": < "Enabled": true >, "InnerClassRemover": < "Enabled": true, "Remap": true, "Remove Metadata": true >, "NameObfuscation": < "Enabled": true, "Excluded classes": "HelloWorld", "Excluded methods": "", "Excluded fields": "" >, "General Settings": < "Custom dictionary": true, "Name dictionary": "hello,world" >, "Packager": < "Enabled": false, "Use MainClass from the JAR manifest": true, "Main class": "HelloWorld" >, "FlowObfuscator": < "Enabled": true, "Mangle Comparisons": true, "Replace GOTO": true, "Replace If": true, "Bad POP": true, "Bad Concat": true, "Mangle Switches": false, "Mangle Return": false, "Mangle Local Variables": false >, "HideMembers": < "Enabled": true >, "Inlining": < "Enabled": false >> 

In some situations you need to prevent certain classes from being obfuscated, such as dependencies packaged with your jar or mixins in a forge mod.

You will need to exclude in two places.

Here is an example script that will obfuscate and remap all classes except the org.json dependency and mixins.

function isRemappingEnabledForClass(node)  var flag1 = !node.name.startsWith("org/json"); var flag2 = !node.name.startsWith("com/client/mixin"); return flag1 && flag2; > function isObfuscatorEnabledForClass(node)  var flag1 = !node.name.startsWith("org/json"); var flag2 = !node.name.startsWith("com/client/mixin"); return flag1 && flag2; >

If you also want to exclude these classes from name obfuscation you will need to go to Transformers -> Name Obfuscation and add these exclusions there.

To Exclude the same classes as we did above, we would need to add the following to Excluded classes, methods and fields.

If your classes are still being obfuscated after applyinng both of these exclusions please open an issue.

  • Click the «Fork» button at the top right hand corner of this page
  • Then run git clone https://github.com/[your github username]/obfuscator.git
  • File -> New -> Project From Existing Sources
  • Select C:\[Path To]\obfuscator\pom.xml
  • Set «Search for projects recursively» and «Import Maven projects automatically» to true and click next
  • Make sure all maven projects are ticked
  • Select the correct Java SDK and go with all the default options for the next pages
Оцените статью