mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
dev
This commit is contained in:
+4
-4
@@ -9,19 +9,19 @@ class UnicodeArrayNodesGroup extends NodesGroup_1.NodesGroup {
|
||||
constructor(options = {}) {
|
||||
super(options);
|
||||
this.unicodeArrayName = Utils_1.Utils.getRandomVariableName(UnicodeArrayNode_1.UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
|
||||
this.unicodeArrayRotateValue = Utils_1.Utils.getRandomInteger(100, 500);
|
||||
this.unicodeArrayTranslatorName = Utils_1.Utils.getRandomVariableName(UnicodeArrayNode_1.UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
|
||||
this.unicodeArrayRotateValue = this.options['rotateUnicodeArray'] ? Utils_1.Utils.getRandomInteger(100, 500) : 0;
|
||||
let unicodeArrayNode = new UnicodeArrayNode_1.UnicodeArrayNode(this.unicodeArrayName, this.unicodeArrayRotateValue), unicodeArray = unicodeArrayNode.getNodeData();
|
||||
this.nodes.set('unicodeArrayNode', unicodeArrayNode);
|
||||
if (this.options['wrapUnicodeArrayCalls']) {
|
||||
this.nodes.set('unicodeArrayCallsWrapper', new UnicodeArrayCallsWrapper_1.UnicodeArrayCallsWrapper(this.unicodeArrayTranslatorName, this.unicodeArrayName, unicodeArray));
|
||||
}
|
||||
if (this.options['rotateUnicodeArray']) {
|
||||
this.nodes.set('unicodeArrayRotateFunctionNode', new UnicodeArrayRotateFunctionNode_1.UnicodeArrayRotateFunctionNode(this.unicodeArrayName, unicodeArray, this.unicodeArrayRotateValue));
|
||||
}
|
||||
if (this.options['encodeUnicodeArray']) {
|
||||
this.nodes.set('unicodeArrayDecodeNode', new UnicodeArrayDecodeNode_1.UnicodeArrayDecodeNode(this.unicodeArrayName, unicodeArray));
|
||||
}
|
||||
if (this.options['rotateUnicodeArray']) {
|
||||
this.nodes.set('unicodeArrayRotateFunctionNode', new UnicodeArrayRotateFunctionNode_1.UnicodeArrayRotateFunctionNode(this.unicodeArrayName, unicodeArray, this.unicodeArrayRotateValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.UnicodeArrayNodesGroup = UnicodeArrayNodesGroup;
|
||||
|
||||
Vendored
+1
-2
@@ -46,8 +46,7 @@ let JavaScriptObfuscator = require('../index'), obfuscatedCode = JavaScriptObfus
|
||||
})();
|
||||
`, {
|
||||
disableConsoleOutput: false,
|
||||
encodeUnicodeArray: true,
|
||||
rotateUnicodeArray: false
|
||||
encodeUnicodeArray: true
|
||||
});
|
||||
console.log(obfuscatedCode);
|
||||
console.log(eval(obfuscatedCode));
|
||||
|
||||
@@ -68,7 +68,8 @@ export class UnicodeArrayDecodeNode extends Node {
|
||||
indexVariableName: string = Utils.getRandomVariableName(),
|
||||
node: INode = esprima.parse(`
|
||||
(function () {
|
||||
!function(){function t(t){this.message=t}var r=[]["filter"]["constructor"]("return this")(),e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";t.prototype=new Error,t.prototype.name="InvalidCharacterError",r.atob||(r.atob=function(r){var o=String(r).replace(/=+$/,"");if(o.length%4==1)throw new t("Have a nice day!");for(var n,a,i=0,c=0,d="";a=o.charAt(c++);~a&&(n=i%4?64*n+a:a,i++%4)?d+=String.fromCharCode(255&n>>(-2*i&6)):0)a=e.indexOf(a);return d})}();
|
||||
//atob polyfill
|
||||
!function(){function t(t){this.message=t}var r=[]["filter"]["constructor"]("return this")(),e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.atob||(r.atob=function(r){var o=String(r).replace(/=+$/,"");for(var n,a,i=0,c=0,d="";a=o.charAt(c++);~a&&(n=i%4?64*n+a:a,i++%4)?d+=String.fromCharCode(255&n>>(-2*i&6)):0)a=e.indexOf(a);return d})}();
|
||||
|
||||
var ${decodedTempArrayName} = [];
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ export class UnicodeArrayNodesGroup extends NodesGroup {
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
private unicodeArrayRotateValue: number = Utils.getRandomInteger(100, 500);
|
||||
private unicodeArrayRotateValue: number;
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
@@ -29,6 +29,8 @@ export class UnicodeArrayNodesGroup extends NodesGroup {
|
||||
constructor (options: IOptions = {}) {
|
||||
super(options);
|
||||
|
||||
this.unicodeArrayRotateValue = this.options['rotateUnicodeArray'] ? Utils.getRandomInteger(100, 500) : 0;
|
||||
|
||||
let unicodeArrayNode: UnicodeArrayNode = new UnicodeArrayNode(
|
||||
this.unicodeArrayName,
|
||||
this.unicodeArrayRotateValue
|
||||
@@ -51,6 +53,16 @@ export class UnicodeArrayNodesGroup extends NodesGroup {
|
||||
);
|
||||
}
|
||||
|
||||
if (this.options['encodeUnicodeArray']) {
|
||||
this.nodes.set(
|
||||
'unicodeArrayDecodeNode',
|
||||
new UnicodeArrayDecodeNode (
|
||||
this.unicodeArrayName,
|
||||
unicodeArray
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (this.options['rotateUnicodeArray']) {
|
||||
this.nodes.set(
|
||||
'unicodeArrayRotateFunctionNode',
|
||||
@@ -61,15 +73,5 @@ export class UnicodeArrayNodesGroup extends NodesGroup {
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (this.options['encodeUnicodeArray']) {
|
||||
this.nodes.set(
|
||||
'unicodeArrayDecodeNode',
|
||||
new UnicodeArrayDecodeNode (
|
||||
this.unicodeArrayName,
|
||||
unicodeArray
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -49,8 +49,7 @@ let JavaScriptObfuscator: any = require('../index'),
|
||||
`,
|
||||
{
|
||||
disableConsoleOutput: false,
|
||||
encodeUnicodeArray: true,
|
||||
rotateUnicodeArray: false
|
||||
encodeUnicodeArray: true
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user