Showing posts with label obfuscation. Show all posts
Showing posts with label obfuscation. 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, May 13, 2026

JObfuscator - Java Source Code Obfuscator

JObfuscator is a Java source code obfuscator. Obfuscate your Java source code & algorithms to protect it against reverse engineering analysis, LLMs, cracking and decompilation.

 JObfuscator has been updated with major changes

  • Online interface - https://www.pelock.com/jobfuscator/
  • Desktop & CLI - https://www.pelock.com/products/jobfuscator/download
  • SDK packages - https://www.pelock.com/products/jobfuscator/api
Desktop app window

JObfuscator Java Source Code Obfuscator


Engine history

v1.30 - 14.05.2026

  • A new obfuscation strategy. Encrypt all double values using floating point math functions from the java.lang.Math.* class.
  • A new obfuscation strategy. Rebuild string literals as runtime-created String objects from hidden char arrays.
  • A new obfuscation strategy. Represent selected integer values through equivalent double math expressions.
  • A new obfuscation strategy. Inject opaque mixer chains and unreachable guards to increase the amount of code decompilers have to analyze.
  • A new obfuscation strategy. Replace plain true and false literals with equivalent runtime expressions.
  • A new obfuscation strategy. Wrap selected safe statements in noisy try/finally blocks while preserving program behavior.
  • A new obfuscation strategy. Encrypt int array contents and decode them at runtime.
  • A new obfuscation strategy. Encrypt double arrays by hiding their values as encoded bit patterns.
  • A new obfuscation strategy. Encrypt char arrays and restore the original characters through generated decoder code.
  • A new obfuscation strategy. Encrypt String array elements and rebuild them while the program runs.
  • A new obfuscation strategy. Split eligible string literals into nested .concat(...) chains so decompilers face more tokens and local data-flow steps; it runs before polymorphic string encryption when both are enabled.
  • Updated the StringEncrypt engine with support for nested polymorphic loops in string encryption.
  • Updated the engine parser configuration to support Java 21 source code constructs.


Client history

v1.3 - 14.05.2026

  • Windows and Linux clients updated with all the new obfuscation strategies
  • Windows client runs the obfuscation process in background now
  • Drag & drop support added for faster Java file opening
  • Command line version supports wildcards now and can process many files at once
  • All the SDK packages updated

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...