All Projects → alexhorn → defendjs

alexhorn / defendjs

Licence: AGPL-3.0 license
A free and open source JavaScript and Node.js obfuscator.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to defendjs

Berserker
Obfuscate your Python scripts better, faster.
Stars: ✭ 81 (+211.54%)
Mutual labels:  obfuscation
LLVM-Obfuscator
LLVM Obfuscator
Stars: ✭ 44 (+69.23%)
Mutual labels:  obfuscation
js-confuser
JS-Confuser is a JavaScript obfuscation tool to make your programs *impossible* to read.
Stars: ✭ 38 (+46.15%)
Mutual labels:  obfuscation
folm
Folm
Stars: ✭ 16 (-38.46%)
Mutual labels:  obfuscation
chameleon
PowerShell Script Obfuscator
Stars: ✭ 319 (+1126.92%)
Mutual labels:  obfuscation
rusty-jsyc
JavaScript-To-Bytecode compiler written in Rust
Stars: ✭ 109 (+319.23%)
Mutual labels:  obfuscation
code-obfuscation
一款iOS代码混淆工具(A code obfuscation tool for iOS.)
Stars: ✭ 32 (+23.08%)
Mutual labels:  obfuscation
id-mask
IDMask is a Java library for masking internal ids (e.g. from your DB) when they need to be published to hide their actual value and to prevent forging. It has support optional randomisation has a wide support for various Java types including long, UUID and BigInteger. This library bases its security on strong cryptographic primitives.
Stars: ✭ 39 (+50%)
Mutual labels:  obfuscation
gnirts
Obfuscate string literals in JavaScript code.
Stars: ✭ 65 (+150%)
Mutual labels:  obfuscation
ConfuserExPlugins
Transforms all types to generics, and all constructor calls and method calls into generic call factories.
Stars: ✭ 32 (+23.08%)
Mutual labels:  obfuscation
react-obfuscate
An intelligent React component to obfuscate any contact link!
Stars: ✭ 87 (+234.62%)
Mutual labels:  obfuscation
nand nor
C++ Compile time NAND/NOR obfuscation
Stars: ✭ 32 (+23.08%)
Mutual labels:  obfuscation
silencio
Silencio is a Java library for transforming and converting XML, JSON, YAML, Properties and other formats. It is applicable for most operations such as obfuscation, encryption, minimisation (minifying), anonymous. Library is fully customizable and extensible.
Stars: ✭ 23 (-11.54%)
Mutual labels:  obfuscation
dumb-obfuscator
Tutorial on how to write the dumbest obfuscator I could think of.
Stars: ✭ 147 (+465.38%)
Mutual labels:  obfuscation
Discord-AIO
Discord AIO (All In One) - discord stealer/token grabber builder with token checks, webhook spammer, obfuscation, encryption, crypto miner, RAT and a lot of extra features.
Stars: ✭ 105 (+303.85%)
Mutual labels:  obfuscation
Jawbreaker
A Python obfuscator using HTTP Requests and Hastebin.
Stars: ✭ 50 (+92.31%)
Mutual labels:  obfuscation
Powershell-Obfuscator
Powerful script for logical obfuscation of powershell scripts
Stars: ✭ 27 (+3.85%)
Mutual labels:  obfuscation
Deobfuscation
Binary Deobfuscation Series
Stars: ✭ 15 (-42.31%)
Mutual labels:  obfuscation
email-concealer
Conceal e-mail addresses in a string by replacing their domain
Stars: ✭ 47 (+80.77%)
Mutual labels:  obfuscation
Alom
Alom PHP Obfuscator / Encoder can protect from your codes
Stars: ✭ 50 (+92.31%)
Mutual labels:  obfuscation

defendjs

defendjs is a free and open-source JavaScript and Node.js obfuscator (not just a mangler or minifier).

Huge thanks to Nikolai Kolodziej for his support and work on the website.

Usage

Install defendjs globally by running npm install -g https://github.com/alexhorn/defendjs.git.

You can run defendjs --help to display the help:

# Usage

defendjs --input [directory] --output [directory] --features [features] --preprocessor [variable]

# Parameters

--input
        Path to input directory or file. Can be repeated multiple times.

--output
        Path to output directory.

--features
        Comma-separated list of features. (available features: dead_code, scope, control_flow, identifiers, literals, mangle, compress)
        e.g. --features scope,control_flow,compress

--preprocessor
        Preprocessor variable declaration or assignment.
        e.g. --preprocessor PLATFORM_WINDOWS --preprocessor PLATFORM_WINDOWS_VERSION=10

# Example

defendjs --input "D:\project\src" --output "D:\project\dist" --features scope,control_flow,compress --preprocessor PLATFORM_WINDOWS

To obfuscate your first project, create a folder (e.g. myproject) and a package.json inside:

{
    "name": "hello-world",
    "main": "myapp.js"
}

Place your JavaScript code in myapp.js (as defined in package.json):

document.onload = function() {
    hello("World");
};

function hello(str) {
    var msg;
    if (str != null) {
        msg = "Hello, " + str + "!";
    } else {
        msg = "*crickets*";
    }
    alert(msg);
}

Obfuscate your app by running defendjs as follows: defendjs --input myproject --output myproject_obfuscated --features=control_flow,literals,mangle,compress

If everything went well, there should now be a myproject_obfuscated folder in your working directory.

Obfuscated example

document.onload = function() {
    hello("World");
};

function hello(str) {
    var msg;
    if (str != null) {
        msg = "Hello, " + str + "!";
    } else {
        msg = "*crickets*";
    }
    alert(msg);
}

becomes

(function(){function a(f,g){var b=new Array(3);;var d=arguments;while(true)try{switch(f){case 156:return;case 22289:d[1][0](e(a,13835,b,d[1])());f=156;break;case 18269:b[2]=d[2];if(b[2]!=null){b[3]=e(a,6999,b,d[1])()+b[2]+e(a,15827,b,d[1])();}else{b[3]=e(a,20220,b,d[1])();}alert(b[3]);f=156;break;case 13835:b[1]='';b[1]+=c(87,111,114,108);b[1]+=c(100);return b[1];case 23638:function k(a,b){return Array.prototype.slice.call(a).concat(Array.prototype.slice.call(b));}function e(){var a=arguments[0],c=Array.prototype.slice.call(arguments,1);var b=function(){return a.apply(this,c.concat(Array.prototype.slice.call(arguments)));};b.prototype=a.prototype;return b;}function h(a,b){return Array.prototype.slice.call(a,b);}function i(b){var c={};for(var a=0;a<b.length;a+=2){c[b[a]]=b[a+1];}return c;}function j(a){return a.map(function(a){return String.fromCharCode(a&~0>>>16)+String.fromCharCode(a>>16);}).join('');}function c(){return String.fromCharCode.apply(null,arguments);}b[0]=e(a,18269,b);document.onload=e(a,22289,b);f=156;break;case 6999:b[1]='';b[1]+=c(72,101,108,108);b[1]+=c(111);b[1]+=c(44);b[1]+=c(32);return b[1];case 15827:b[1]='';b[1]+=c(33);return b[1];case 20220:b[1]='';b[1]+=c(42,99,114);b[1]+=c(105,99,107);b[1]+=c(101,116,115);b[1]+=c(42);return b[1];}}catch(a){$$defendjs$tobethrown=null;switch(f){default:throw a;}}}a(23638,{});}())

Advanced Usage

If your project requires multiple output files, e.g. because it runs as multiple node processes running multiple scripts, you can add a directive in the package.json page to create a separate output file for every main file:

{
    "name": "hello-world",
    "defendjs": {
        "mainFiles": [ "first.js", "second.js" ]
    }
}

Alternatively you can check out the JavaScript API here.

License

defendjs is licensed under the GNU Affero General Public License v3.0.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].