This commit is contained in:
G047 2017-02-09 14:22:05 +00:00 committed by GitHub
commit 3b87e49029
4 changed files with 56 additions and 0 deletions

View file

@ -248,6 +248,7 @@ var Categories = [
"JavaScript Parser",
"JavaScript Beautify",
"JavaScript Minify",
"JavaScript Obfscate",
"JSON Beautify",
"JSON Minify",
"XML Beautify",

View file

@ -2491,6 +2491,13 @@ var OperationConfig = {
outputType: "string",
args: []
},
"JavaScript Obfscate": {
description: "Obfscate JavaScript code.",
run: JS.run_minify,
input_type: "string",
output_type: "string",
args: []
},
"XML Beautify": {
description: "Indents and prettifies eXtensible Markup Language (XML) code.",
run: Code.runXmlBeautify,

View file

@ -10,7 +10,18 @@
* @namespace
*/
var JS = {
/**
* JavaScript Obfscate operation.
*
* @param {string} input
* @returns {string}
*/
run_obfscate : function(input) {
return require('./javascriptObfscate').obfscate(input);
},
/**
* @constant
* @default

View file

@ -0,0 +1,37 @@
/* globals UAS_parser */
/**
* Javascript Obfscate operations.
*
* @author G047 [drgoatyt@gmail.com]
* @copyright Crown Copyright 2016
* @license MIT
*
* @namespace
*/
var JavascriptObfscate = {
obfuscator : require('javascript-obfuscator'), //Needs to be installed with the package.json
/**
* Obfscate javascript operation.
*
* @param {string} source
* @returns {string}
*/
obfscate : function (source) {
var obfuscationResult = this.obfuscate(source, {
compact: true,
debugProtection: true,
debugProtectionInterval: true,
selfDefending: true,
});
source = obfuscationResult.getObfuscatedCode();
return source;
}
};
module.exports = JavascriptObfscate;