jshaman-javascript-obfuscator
v1.0.4
Published
An easy-to-use online commercial JavaScript obfuscation tool
Downloads
9
Maintainers
Readme
JShaman JavaScript Obfuscator
https://www.jshaman.com/en/ An easy-to-use online commercial JavaScript obfuscation tool
Introduction
Easy to use, no registration or login required One-click JavaScript code obfuscation
Advantage
Easy to use Without the need for registration or login, JavaScript code obfuscation can be done quickly and easily with just a secret key. Web API You can call the JShaman Web API on your websites, products, or projects to achieve convenient JavaScript obfuscation. Powerful JShaman JavaScript Obfuscator employs over 20 techniques to obfuscate and encrypt JavaScript code, ensuring that the obfuscated code is unreadable and unintelligible. Polymorphic The same code can produce different obfuscation results every time, with different variable names and function names, as well as random and diverse zombie codes, different control flows, etc.
Installation
$ npm install jshaman-javascript-obfuscator
Usage
//JShaman JavaScript Obfuscator Web API Interface
var jshaman_javascript_obfuscator = require("jshaman-javascript-obfuscator");
//Javascript code, obfuscation options and secret key
var javascript_code = "...";
var options = "...";
var secret_key ="...";
//Obfuscation result
var obfuscated_result = jshaman_javascript_obfuscator(javascript_code, options, secret_key);
console.log(obfuscated_result.state, obfuscated_result.content);
example
//JShaman JavaScript Obfuscator Web API Interface
var jshaman_javascript_obfuscator = require("jshaman-javascript-obfuscator");
//JavaScript Code to be obfuscated
var javascript_code = `
function NewObject(prefix)
{
var count=0;
this.SayHello=function(msg)
{
count++;
alert(prefix+msg);
}
this.GetCount=function()
{
return count;
}
}
var obj=new NewObject("Message : ");
obj.SayHello("You are welcome.");
`;
//Options.
//Please refer to the official website of JShaman in English for relevant instructions.
//https://www.jshaman.com/en/
var options = {
"part_variable_identifier_obfuscate": 1,
"global_variable_identifier_obfuscate": 0,
"part_function_identifier_obfuscate":0,
"global_function_identifier_obfuscate": 0,
"member_expression_encode": 1,
"numberic_literal_encode": 1,
"binary_express_obfuscate": 1,
"boolean_encode": 1,
"json_encode":1,
"regexp_encode":1,
"string_unicode_encode": 1,
"assignment_junk_code":1,
"zombie_code": 1,
"eval_encode": 1,
"control_flow": 1,
"string_reverse": 1,
"comma_operator": 1,
"string_array": 0,
"string_array_encode": 0,
"vm_execute": 0,
"ast_execute": 0,
"no_beautifier": 0,
"tamper_proof": 0,
"comments": 0,
"compress": 1,
"reserved_word": ["jshaman","w2sfot"]
}
//Secret key,Obtained from the JShaman official website.
//If not yet obtained, it can be set to free
var secret_key = "free";
var obfuscated_result = jshaman_javascript_obfuscator(javascript_code, options, secret_key);
//Obfuscation result,
//if "state" is 0 it means successful and the "content" is the obfuscated JavaScript code.
//Otherwise,if there is an error,the "message" will contain an error prompt message.
console.log(obfuscated_result.state, obfuscated_result.message, obfuscated_result.content);
//Obfuscted javascript code
/*
var _0xce7d8a = ["117.", "92.103.98.103.102.126.103.41.72.90.93.41.125.112.121.108.51.", "117.", "117."];
function _0x57d18d(_4, _5) {
_5 = 9;
var _,
_2,
_3 = "";
_2 = _4.split(".");
for (_ = 0; _ < _2.length - 1; _++) {
_3 += String.fromCharCode(_2[_] ^ _5);
}
return _3;
}
var visitors = {
File(node, scope) {
ast_excute(node['\x70\x72\x6f\x67\x72\x61\x6d'], scope);
},
Program(program, scope) {
for (i = function () {
return eval(String.fromCharCode(57, 48, 53, 49, 49, 53, 32, 94, 32, 57, 48, 53, 49, 49, 53));
}(); eval(String.fromCharCode(105, 32, 60, 32, 112, 114, 111, 103, 114, 97, 109, 91, 39, 92, 120, 54, 50, 92, 120, 54, 102, 92, 120, 54, 52, 92, 120, 55, 57, 39, 93, 91, 39, 92, 120, 54, 99, 92, 120, 54, 53, 92, 120, 54, 101, 92, 120, 54, 55, 92, 120, 55, 52, 92, 120, 54, 56, 39, 93)); eval(String.fromCharCode(105, 43, 43))) {
ast_excute(program['\x62\x6f\x64\x79'][i], scope);
}
},
ExpressionStatement(node, scope) {
return ast_excute(node['\x65\x78\x70\x72\x65\x73\x73\x69\x6f\x6e'], scope);
},
CallExpression(node, scope) {
var func = ast_excute(node['\x63\x61\x6c\x6c\x65\x65'], scope);
var args = node['\x61\x72\x67\x75\x6d\x65\x6e\x74\x73']['\x6d\x61\x70'](function (arg) {
return ast_excute(arg, scope);
});
var value;
if (eval(String.fromCharCode(110, 111, 100, 101, 91, 39, 92, 120, 54, 51, 92, 120, 54, 49, 92, 120, 54, 99, 92, 120, 54, 99, 92, 120, 54, 53, 92, 120, 54, 53, 39, 93, 91, 39, 92, 120, 55, 52, 92, 120, 55, 57, 92, 120, 55, 48, 92, 120, 54, 53, 39, 93, 32, 61, 61, 61, 32, 39, 77, 101, 109, 98, 101, 114, 69, 120, 112, 114, 101, 115, 115, 105, 111, 110, 39))) {
value = ast_excute(node['\x63\x61\x6c\x6c\x65\x65']['\x6f\x62\x6a\x65\x63\x74'], scope);
}
return func['\x61\x70\x70\x6c\x79'](value, args);
},
MemberExpression(node, scope) {
var obj = ast_excute(node['\x6f\x62\x6a\x65\x63\x74'], scope);
var name = node['\x70\x72\x6f\x70\x65\x72\x74\x79']['\x6e\x61\x6d\x65'];
return obj[name];
},
Identifier(node, scope) {
return scope[node['\x6e\x61\x6d\x65']];
},
StringLiteral(node) {
return node['\x76\x61\x6c\x75\x65'];
},
NumericLiteral(node) {
return node['\x76\x61\x6c\x75\x65'];
}
};
function ast_excute(node, scope) {
var _0x51e = "2|1|0".split(_0x57d18d(_0xce7d8a[0])),
_0x6ebgc = 0;
while (!![]) {
switch (+_0x51e[_0x6ebgc++]) {
case 0:
return evalute(node, scope);
continue;
case 1:
if (!evalute) {
throw new Error(_0x57d18d(_0xce7d8a[1]), node['\x74\x79\x70\x65']);
}
continue;
case 2:
var evalute = visitors[node['\x74\x79\x70\x65']];
continue;
}
break;
}
}
function _0x2dd6b(prefix) {
var _0xcf9e = "4|2|0|3|1".split(_0x57d18d(_0xce7d8a[2])),
_0xef765g = 0;
while (!![]) {
switch (+_0xcf9e[_0xef765g++]) {
case 0:
_0x38e = function () {
return eval(String.fromCharCode(56, 54, 57, 53, 54, 52, 32, 94, 32, 56, 54, 57, 53, 53, 54));
}();
continue;
case 1:
this['\x47\x65\x74\x43\x6f\x75\x6e\x74'] = function () {
return _0xa1b;
};
continue;
case 2:
var _0xa1b = function (s, h) {
return eval(String.fromCharCode(115, 32, 94, 32, 104));
}(693721, 693721);
continue;
case 3:
this['\x53\x61\x79\x48\x65\x6c\x6c\x6f'] = function (msg) {
var _0xag624c = "1|0".split(_0x57d18d(_0xce7d8a[3])),
_0xc1411b = 0;
while (!![]) {
switch (+_0xag624c[_0xc1411b++]) {
case 0:
alert(eval(String.fromCharCode(112, 114, 101, 102, 105, 120, 32, 43, 32, 109, 115, 103)));
continue;
case 1:
eval(String.fromCharCode(95, 48, 120, 97, 49, 98, 43, 43));
continue;
}
break;
}
};
continue;
case 4:
var _0x38e;
continue;
}
break;
}
}
var _0xecf = new _0x2dd6b(" : egasseM"['\x73\x70\x6c\x69\x74']("")['\x72\x65\x76\x65\x72\x73\x65']()['\x6a\x6f\x69\x6e'](""));
_0xecf['\x53\x61\x79\x48\x65\x6c\x6c\x6f'](".emoclew era uoY"['\x73\x70\x6c\x69\x74']("")['\x72\x65\x76\x65\x72\x73\x65']()['\x6a\x6f\x69\x6e'](""));
*/