Showing posts with label obfuscator. Show all posts
Showing posts with label obfuscator. Show all posts

Wednesday, July 29, 2026

PowerShell Obfuscator & Virtualizer - How to Protect PowerShell Scripts

Looking for a PowerShell obfuscator that can protect .ps1 source without turning your automation into a maintenance nightmare? In this post I explain why I built PowerShell Pro Obfuscator, how PowerShell script obfuscation works in practice, and what you get before vs after.

Why obfuscate PowerShell scripts?

PowerShell is great for automation on Windows and Linux. The problem is distribution: a .ps1 file (or a module) is usually plain text. Anyone with file access can open it, search for passwords and API keys, copy your logic, or patch a license check in minutes.

There is no real “compile to binary” step that hides intent the way native apps sometimes do. If your script is the product, you need PowerShell script protection — not security theater, just a higher cost of casual reading and editing.

That is why I built PowerShell Pro Obfuscator: a dedicated tool to obfuscate PowerShell .ps1 files with renaming, encryption, control-flow transforms, virtualization, and runtime checks.

PowerShell Pro Obfuscator — PowerShell obfuscator GUI

What is PowerShell Pro Obfuscator?

PowerShell Pro Obfuscator is my PowerShell obfuscator / virtualizer for proprietary scripts. It:

  • Parses .ps1 source into an AST

  • Applies selectable obfuscation passes

  • Emits a new protected PowerShell script

I ship the same engine as a Windows GUI, a command-line PowerShell obfuscator for Windows and Linux (useful in CI), plus an online tool and API.

PowerShell obfuscation options

You can keep protection light (rename + encrypt strings) or turn on heavier layers when the script matters more.

PowerShell obfuscation techniques I use

Polymorphic string and number encryption

People grep for URLs, keys, and messages first. I encrypt strings and integers so each build looks different, and I add decoy noise. At runtime the script still decrypts to the same values — the file on disk is just harder to read.

Code virtualization for PowerShell

Selected statements can be lifted into a small random VM (shuffled opcodes, decoy cases, obfuscated dispatcher). Analysts then face a virtual machine instead of plain PowerShell lines. I treat this as optional; it costs more CPU than simple renaming.

Finite-state automata (FSA) transforms

Linear code is easy to follow. FSA obfuscation rewrites blocks into state machines with shuffled handlers and decoy paths, so control flow no longer reads top-to-bottom like a tutorial.

Anti-debugging in obfuscated PowerShell

I insert probes for attached debuggers, breakpoints, and common debug / trace preferences. If a check fires, the script can exit silently — useful against casual interactive analysis.

Self-integrity checks

A bootstrap check verifies the on-disk script still matches the obfuscated build. Decryptors depend on a tamper key, so a casually patched .ps1 often returns garbage instead of plaintext.

Before and after PowerShell obfuscation

Before — obvious intent:

function Get-Greeting {
    param([string]$Name)
    Write-Host "Hello World from $Name!"
}
Get-Greeting "PowerShell Pro Obfuscator"

After — same idea, much harder to skim (real excerpt, truncated):

$script:_HnJTskg = 0
$jwNTQ = 297 * 400 + 36
$x4e8bfda = [Math]::Abs($jwNTQ - 8074)
function gnJjzMCN3V8P {
    param([int]$slot, [int]$salt, [int]$guard)
    if (-not ((Get-Variable -Name _HnJTskg -Scope Script -ErrorAction SilentlyContinue).Value)) { return '' }
    $d = @(46866, 46865)
    $r = ''
    for ($i = 0; $i -lt $d.Length; $i++) {
        [long]$v = [long]$d[$i]
        # ... polymorphic decode loop ...
        if ([long]$v -ge 0 -and [long]$v -le 0xFFFF) { $r += [char][int][long]$v }
    }
    return $r
}
...

If you only had the obfuscated file, would you still spot a simple greeting helper?

Obfuscated PowerShell script example

How this PowerShell obfuscator works

Pipeline in short: parse → transform → emit .ps1.

Passes can include renaming, control-flow flattening, FSA, VM virtualization, polymorphic encryption, noise, integrity probes, a protection linker, and anti-debugging. Always test the output in your real PowerShell host — grammar and hosting edge cases still exist.

PowerShell Pro Obfuscator pipeline

CLI: obfuscate PowerShell scripts in CI

For build servers I use the command-line client on Windows or Linux: obfuscate the release script, run smoke tests, then publish the protected .ps1.

PowerShell obfuscator command line

Try PowerShell Pro Obfuscator

If you need to obfuscate PowerShell scripts, protect proprietary .ps1 logic, or add virtualization and integrity checks without reinventing the pipeline, start here:

Product page: PowerShell Pro Obfuscator — obfuscate & protect PowerShell scripts

Questions? Contact me.

Wednesday, June 10, 2026

Java Obfuscator for Maven

JObfuscator is a modern Java obfuscator. It operates at the source code level & employs a range of obfuscation techniques to protect the code against decompilation, reverse engineering, and LLM analysis.

Java Obfuscator

How to use Java obfuscator?

The easiest way to use JObfuscator is via Maven pre-compiler plugin. Follow the steps to add JObfuscator to your Maven build workflow:

Step 1 - integrate into your Maven workflow

Add the plugin, annotation library and its settings to your application pom.xml, minimal configuration:


<?
xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>my-app</artifactId>
  <version>1.0.0-SNAPSHOT</version>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.release>11</maven.compiler.release>
    <jobfuscator.apiKey><!-- YOU-API-HERE or leave empty for DEMO VERSION --></jobfuscator.apiKey>
    <jobfuscator.version><!-- e.g. 1.0.3 --></jobfuscator.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>com.pelock</groupId>
      <artifactId>jobfuscator-annotations</artifactId>
      <version>${jobfuscator.version}</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>com.pelock</groupId>
        <artifactId>jobfuscator-maven-plugin</artifactId>
        <version>${jobfuscator.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>obfuscate-sources</goal>
            </goals>
            <phase>generate-sources</phase>
          </execution>
        </executions>
        <configuration>
          <apiKey>${jobfuscator.apiKey}</apiKey>
          <enableCompression>true</enableCompression>
          <mixCodeFlow>true</mixCodeFlow>
          <renameVariables>true</renameVariables>
          <renameMethods>true</renameMethods>
          <shuffleMethods>true</shuffleMethods>
          <intsMathCrypt>true</intsMathCrypt>
          <cryptStrings>true</cryptStrings>
          <stringSplit>true</stringSplit>
          <intsToArrays>true</intsToArrays>
          <dblsToArrays>true</dblsToArrays>
          <dblsMathCrypt>true</dblsMathCrypt>
          <stringCharVault>true</stringCharVault>
          <intsFromDoubleMath>true</intsFromDoubleMath>
          <opaqueMixerChain>true</opaqueMixerChain>
          <complexifyBooleans>true</complexifyBooleans>
          <tryFinallyNoise>true</tryFinallyNoise>
          <selfCheck>true</selfCheck>
          <arrayIntCrypt>true</arrayIntCrypt>
          <arrayCharCrypt>true</arrayCharCrypt>
          <arrayDoubleCrypt>true</arrayDoubleCrypt>
          <arrayStringCrypt>true</arrayStringCrypt>
          <selfCheck>true</selfCheck>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.13.0</version>
        <configuration>
          <release>${maven.compiler.release}</release>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>


Step 2 - prepare your source codes

Annotate your sources to enable obfuscation in the build process:

import java.util.*;
import java.lang.*;
import java.io.*;

//
// you MUST include a custom annotation
// to enable the entire class or a single
// method obfuscation
//
@Obfuscate
class Ideone
{
    //@Obfuscate
    public static double calculateSD(double numArray[])
    {
        double sum = 0.0, standardDeviation = 0.0;
        int length = numArray.length;

        for(double num : numArray) {
            sum += num;
        }

        double mean = sum/length;

        for(double num: numArray) {
            standardDeviation += Math.pow(num - mean, 2);
        }

        return Math.sqrt(standardDeviation/length);
    }

    //
    // selective obfuscation strategies
    // can be applied for the entire
    // class or a single method (by
    // default all obfuscation strategies
    // are enabled when you use @Obfuscate
    // annotation alone)
    //
    //@Obfuscate(
    //  ints_math_crypt = true,
    //  dbls_math_crypt = true,
    //  string_split = true,
    //  crypt_strings = true,
    //  string_char_vault = true,
    //  rename_methods = false,
    //  rename_variables = true,
    //  shuffle_methods = true,
    //  array_int_crypt = true,
    //  array_double_crypt = true,
    //  array_char_crypt = true,
    //  array_string_crypt = true,
    //  mix_code_flow = true,
    //  ints_from_double_math = true,
    //  opaque_mixer_chain = true,
    //  complexify_booleans = true,
    //  try_finally_noise = true,
    //  ints_to_arrays = true,
    //  dbls_to_arrays = true,
    //  self_check = true
    // )
    public static void main(String[] args) {

        double[] numArray = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
        double SD = calculateSD(numArray);

        System.out.format("Standard Deviation = %.6f", SD);
    }
}
And that's all! Just build your project like you did before. The obfuscation process is automated and fully invisible to you.

For more obfuscation features of the Maven plugin please refer to the official JObfuscator Maven Compiler documentation.

Tuesday, September 13, 2022

Java Source Code Obfuscator - JObfuscator

Obfuscate your Java source code & algorithms to protect it against reverse engineering analysis, cracking, and decompilation.

JObfuscator is a Java source code obfuscator to protect your work at the source code level. After compilation of the protected and obfuscated code - it will be extremely hard to reverse engineer the compiled bytecode, forget about Java decompilers!

Java Obfuscator - JObfuscator

Changes:

v1.10 - 09.08.2022
  • Fixed an error in the order of variable declarations when using obfuscation to change the linear path of code execution (thank you Yi Wu)
  • Automatically adding special annotation for IntelliJ IDE @SuppressWarnings(InstanceVariableMayNotBeInitialized) for the non-linear code path obfuscation

v1.09 - 06.02.2022
  • Fixed bug in annotation handling that caused string encryption obfuscation to work incorrectly
v1.08 - 19.10.2021
  • Fixed renaming methods within the same class
v1.07 - 17.08.2021
  • Improved integer to arrays obfuscation by generating multidimensional arrays e.g. int[][] var_3035 = { { 65535 }, { 01, 02, 0b0 } };
  • Improved doubles to arrays obfuscation by generating multidimensional arrays e.g. double[][][] O_ZzBf7_4tcNvh_c = { { { 2.8 } }, { { 1.3 } }, { { 0.06, 3.7, 65535.8 } } };

Saturday, July 31, 2021

Best Java Obfuscator?

Our Java Obfuscator - JObfuscator has been updated to include new Java obfuscation strategies.

Best Java Obfuscator - JObfuscator

Obfuscation engine history

v1.03 - 31.07.2021
  • Some integers were not extracted correctly for the integers to arrays obfuscation strategy
  • Multilevel obfuscation of extracted integers into the arrays (into a random number of double and integer arrays)
v1.02 - 30.07.2021
  • An integers to arrays obfuscation strategy, converts the integer values into double values to avoid deobfuscation by popular Java decompilers e.g. double[] var_2597 = new double[]{13.898355719807563D, 65535.73657403742D, ... };
v1.01 - 28.07.2021
  • A new obfuscation strategy. For each method, extract all possible integers from the code and store them in an array. It makes the analysis harder because it requires an indexed table lookup for every numeric value.

Client history


v1.01 - 28.07.2021
  • All clients (Windows, Linux) and SDKs (PHP & Python) updated to include the new obfuscation strategy /IntsToArrays

Sunday, July 25, 2021

JObfuscator Java Obfuscator

JObfuscator is a Java source code obfuscator. Secure your Java source code and algorithms.

Protect Java source code & algorithms from hacking, cracking, reverse engineering, decompilation & technology theft.


More information at:

https://www.pelock.com/products/jobfuscator


An online obfuscator interface:

https://www.pelock.com/jobfuscator/


Automate obfuscation with PHP & Python SDKs (with sources on GitHub)

https://www.pelock.com/products/jobfuscator/api


Windows & Linux clients (GUI & console version)

https://www.pelock.com/products/jobfuscator/download


Screenshots

JObfuscator console version

An obufscated and protected Java source code

Java obfuscator options panel

JObfuscator Java Source Code Obfuscator


Friday, January 1, 2021

Obfuscate AutoIt Scripts from Python code

If you would like to protect your AutoIt scripts from hackers and decompilation you might want to obfuscate their source code with an AutoIt Obfuscator.

Obfuscation protects the original AutoIt source code against analysis & reverse engineering. Unfortunately, AutoIt decompilation is easy with tools like aut2exe (try it yourself).

Obfuscation protects the AutoIt code against reversing, so even after decompilation the source code will stay safe from prying eyes, hackers, and competition.

Now it's possible to automate this process using Python 3 code with a dedicated Python 3 module:

https://pypi.org/project/autoitobfuscator/

Source code of this module along with usage examples is available at GitHub:

https://github.com/PELock/AutoIt-Obfuscator-Python

Sample usage example in Python:
#!/usr/bin/env python

###############################################################################
#
# AutoIt Obfuscator WebApi interface usage example.
#
# In this example we will obfuscate sample source with default options.
#
# Version        : v1.0
# Language       : Python
# Author         : Bartosz Wójcik
# Web page       : https://www.pelock.com
#
###############################################################################

#
# include AutoIt Obfuscator module
#
from autoitobfuscator import AutoItObfuscator

#
# if you don't want to use Python module, you can import directly from the file
#
#from pelock.autoitobfuscator import AutoItObfuscator

#
# create AutoIt Obfuscator class instance (we are using our activation key)
#
myAutoItObfuscator = AutoItObfuscator("ABCD-ABCD-ABCD-ABCD")

#
# source code in AutoIt v3 format
#
scriptSourceCode = 'ConsoleWrite("Hello World")'

#
# by default all options are enabled, both helper random numbers
# generation & obfuscation strategies, so we can just simply call:
#
result = myAutoItObfuscator.obfuscate_script_source(scriptSourceCode)

#
# it's also possible to pass script path instead of a string with the source e.g.
#
# result = myAutoItObfuscator.obfuscate_script_file("/path/to/script/source.au3")

#
# result[] array holds the obfuscation results as well as other information
#
# result["error"]         - error code
# result["output"]        - obfuscated code
# result["demo"]          - was it used in demo mode (invalid or empty activation key was used)
# result["credits_left"]  - usage credits left after this operation
# result["credits_total"] - total number of credits for this activation code
# result["expired"]       - if this was the last usage credit for the activation key it will be set to True
#
if result and "error" in result:

    # display obfuscated code
    if result["error"] == AutoItObfuscator.ERROR_SUCCESS:

        # format output code for HTML display
        print(result["output"])

    else:
        print(f'An error occurred, error code: {result["error"]}')

else:
  print("Something unexpected happen while trying to obfuscate the code.")

PowerShell Obfuscator & Virtualizer - How to Protect PowerShell Scripts

Looking for a PowerShell obfuscator that can protect .ps1 source without turning your automation into a maintenance nightmare? In this pos...