mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
Merge pull request #472 from javascript-obfuscator/issue-419
Fixed for-await-of statement with `compact: true`
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
Change Log
|
||||
|
||||
v0.20.3
|
||||
---
|
||||
* Fixed `for-await-of` statement: https://github.com/javascript-obfuscator/javascript-obfuscator/issues/419
|
||||
|
||||
v0.20.2
|
||||
---
|
||||
* Fixed https://github.com/javascript-obfuscator/javascript-obfuscator/pull/442
|
||||
|
||||
Vendored
+4
-4
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "javascript-obfuscator",
|
||||
"version": "0.20.2",
|
||||
"version": "0.20.3",
|
||||
"description": "JavaScript obfuscator",
|
||||
"keywords": [
|
||||
"obfuscator",
|
||||
@@ -26,7 +26,7 @@
|
||||
"chance": "1.1.4",
|
||||
"class-validator": "0.11.0",
|
||||
"commander": "4.0.1",
|
||||
"escodegen-wallaby": "1.6.27",
|
||||
"escodegen": "1.12.1",
|
||||
"espree": "6.1.2",
|
||||
"estraverse": "4.3.0",
|
||||
"eventemitter3": "4.0.0",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { inject, injectable, } from 'inversify';
|
||||
import { ServiceIdentifiers } from './container/ServiceIdentifiers';
|
||||
|
||||
import * as escodegen from 'escodegen-wallaby';
|
||||
import * as escodegen from 'escodegen';
|
||||
import * as espree from 'espree';
|
||||
import * as ESTree from 'estree';
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
/* tslint:disable:interface-name */
|
||||
|
||||
import * as escodegen from 'escodegen-wallaby';
|
||||
import * as escodegen from 'escodegen';
|
||||
|
||||
declare module 'estree' {
|
||||
export interface BaseNodeMetadata {
|
||||
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
declare module 'escodegen-wallaby' {
|
||||
export * from 'escodegen';
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/* tslint:disable:max-file-line-count */
|
||||
|
||||
import * as escodegen from 'escodegen-wallaby';
|
||||
import * as escodegen from 'escodegen';
|
||||
import * as ESTree from 'estree';
|
||||
|
||||
import { TStatement } from '../types/node/TStatement';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as escodegen from 'escodegen-wallaby';
|
||||
import * as escodegen from 'escodegen';
|
||||
import * as espree from 'espree';
|
||||
import * as estraverse from 'estraverse';
|
||||
import * as ESTree from 'estree';
|
||||
|
||||
Vendored
-1
@@ -1,5 +1,4 @@
|
||||
/// <reference path="../../src/declarations/escodegen.d.ts" />
|
||||
/// <reference path="../../src/declarations/escodegen-wallaby.d.ts" />
|
||||
/// <reference path="../../src/declarations/espree.d.ts" />
|
||||
/// <reference path="../../src/declarations/ESTree.d.ts" />
|
||||
/// <reference path="../../src/declarations/js-string-escape.d.ts" />
|
||||
+8
-38
@@ -1,51 +1,21 @@
|
||||
'use strict';
|
||||
import { IdentifierNamesGenerator } from '../../src/enums/generators/identifier-names-generators/IdentifierNamesGenerator';
|
||||
|
||||
import { NO_ADDITIONAL_NODES_PRESET } from '../../src/options/presets/NoCustomNodes';
|
||||
|
||||
(function () {
|
||||
const JavaScriptObfuscator: any = require('../../index');
|
||||
|
||||
let obfuscatedCode: string = JavaScriptObfuscator.obfuscate(
|
||||
`
|
||||
// Paste your JavaScript code here
|
||||
function hi() {
|
||||
console.log("Hello World!");
|
||||
async function testFunc(params) {
|
||||
for await (let param of params) {
|
||||
|
||||
}
|
||||
}
|
||||
hi();
|
||||
testFunc(['foo']);
|
||||
`,
|
||||
{
|
||||
compact: false,
|
||||
selfDefending: false,
|
||||
disableConsoleOutput: false,
|
||||
debugProtection: false,
|
||||
debugProtectionInterval: false,
|
||||
splitStrings: true,
|
||||
splitStringsChunkLength: 5,
|
||||
splitStringsChunkLengthEnabled: true,
|
||||
stringArray: true,
|
||||
rotateStringArray: false,
|
||||
rotateStringArrayEnabled: true,
|
||||
stringArrayThreshold: 1,
|
||||
stringArrayThresholdEnabled: true,
|
||||
stringArrayEncoding: false,
|
||||
stringArrayEncodingEnabled: true,
|
||||
sourceMap: false,
|
||||
sourceMapBaseUrl: "",
|
||||
sourceMapFileName: "",
|
||||
sourceMapSeparate: false,
|
||||
domainLock: [],
|
||||
reservedNames: [],
|
||||
reservedStrings: [],
|
||||
seed: 0,
|
||||
controlFlowFlatteningThreshold: 1,
|
||||
controlFlowFlattening: true,
|
||||
deadCodeInjectionThreshold: 1,
|
||||
deadCodeInjection: true,
|
||||
unicodeEscapeSequence: false,
|
||||
renameGlobals: true,
|
||||
identifierNamesGenerator: IdentifierNamesGenerator.DictionaryIdentifierNamesGenerator,
|
||||
identifiersDictionary: ["foo", "bar", "baz", "bark", "hawk", "fooz", "moscow", "chikago"],
|
||||
identifiersPrefix: "",
|
||||
transformObjectKeys: true
|
||||
...NO_ADDITIONAL_NODES_PRESET
|
||||
}
|
||||
).getObfuscatedCode();
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
async function test(params) {
|
||||
for await (let param of params) {}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import { JavaScriptObfuscator } from '../../../src/JavaScriptObfuscatorFacade';
|
||||
// https://github.com/javascript-obfuscator/javascript-obfuscator/issues/321
|
||||
//
|
||||
describe('Issue #321', () => {
|
||||
describe('Fixture code should nor break', () => {
|
||||
describe('Fixture code should not break', () => {
|
||||
let obfuscatedCode: string;
|
||||
|
||||
before(() => {
|
||||
|
||||
@@ -8,7 +8,7 @@ import { IdentifierNamesGenerator } from "../../../src/enums/generators/identifi
|
||||
// https://github.com/javascript-obfuscator/javascript-obfuscator/issues/355
|
||||
//
|
||||
describe('Issue #355', () => {
|
||||
describe('Fixture code should nor break', () => {
|
||||
describe('Fixture code should not break', () => {
|
||||
let obfuscatedCode: string;
|
||||
|
||||
before(() => {
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import { assert } from 'chai';
|
||||
import { NO_ADDITIONAL_NODES_PRESET } from '../../../src/options/presets/NoCustomNodes';
|
||||
import { readFileAsString } from '../../helpers/readFileAsString';
|
||||
import { JavaScriptObfuscator } from '../../../src/JavaScriptObfuscatorFacade';
|
||||
|
||||
//
|
||||
// https://github.com/javascript-obfuscator/javascript-obfuscator/issues/419
|
||||
//
|
||||
describe('Issue #419', () => {
|
||||
describe('Fixture code should not break', () => {
|
||||
const codeRegExp: RegExp = /for await/;
|
||||
|
||||
let obfuscatedCode: string;
|
||||
|
||||
before(() => {
|
||||
const code: string = readFileAsString(__dirname + '/fixtures/issue419.js');
|
||||
|
||||
obfuscatedCode = JavaScriptObfuscator.obfuscate(
|
||||
code,
|
||||
{
|
||||
...NO_ADDITIONAL_NODES_PRESET,
|
||||
compact: true
|
||||
}
|
||||
).getObfuscatedCode();
|
||||
});
|
||||
|
||||
it('does not break on obfuscating', () => {
|
||||
assert.doesNotThrow(() => eval(obfuscatedCode));
|
||||
});
|
||||
|
||||
it('should return correct `for-await-of` statement', () => {
|
||||
assert.match(obfuscatedCode, codeRegExp);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -7,8 +7,7 @@ import { JavaScriptObfuscator } from '../../../src/JavaScriptObfuscatorFacade';
|
||||
// https://github.com/javascript-obfuscator/javascript-obfuscator/issues/424
|
||||
//
|
||||
describe('Issue #424', () => {
|
||||
|
||||
describe('Fixture code should nor break', () => {
|
||||
describe('Fixture code should not break', () => {
|
||||
let obfuscatedCode: string;
|
||||
|
||||
before(() => {
|
||||
|
||||
@@ -7,7 +7,6 @@ import { JavaScriptObfuscator } from '../../../src/JavaScriptObfuscatorFacade';
|
||||
// https://github.com/javascript-obfuscator/javascript-obfuscator/issues/437
|
||||
//
|
||||
describe('Issue #437', () => {
|
||||
|
||||
describe('Fixture code should not break on obfuscating', () => {
|
||||
let doObfuscate: Function;
|
||||
|
||||
|
||||
@@ -49,6 +49,11 @@ import './functional-tests/custom-nodes/domain-lock-nodes/DomainLockNode.spec';
|
||||
import './functional-tests/custom-nodes/string-array-nodes/StringArrayCallsWrapper.spec';
|
||||
import './functional-tests/custom-nodes/string-array-nodes/StringArrayRotateFunctionNode.spec';
|
||||
import './functional-tests/custom-nodes/string-array-nodes/StringArrayNode.spec';
|
||||
import './functional-tests/issues/issue321.spec';
|
||||
import './functional-tests/issues/issue355.spec';
|
||||
import './functional-tests/issues/issue419.spec';
|
||||
import './functional-tests/issues/issue424.spec';
|
||||
import './functional-tests/issues/issue437.spec';
|
||||
import './functional-tests/javascript-obfuscator/JavaScriptObfuscator.spec';
|
||||
import './functional-tests/node-transformers/control-flow-transformers/block-statement-control-flow-transformer/BlockStatementControlFlowTransformer.spec';
|
||||
import './functional-tests/node-transformers/control-flow-transformers/function-control-flow-transformer/FunctionControlFlowTransformer.spec';
|
||||
|
||||
@@ -485,11 +485,6 @@ ajv@^6.1.0, ajv@^6.10.2, ajv@^6.5.5:
|
||||
json-schema-traverse "^0.4.1"
|
||||
uri-js "^4.2.2"
|
||||
|
||||
amdefine@>=0.0.4:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5"
|
||||
integrity sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=
|
||||
|
||||
ansi-colors@3.2.3:
|
||||
version "3.2.3"
|
||||
resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-3.2.3.tgz#57d35b8686e851e2cc04c403f1c00203976a1813"
|
||||
@@ -1552,17 +1547,17 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.5:
|
||||
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
|
||||
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
|
||||
|
||||
escodegen-wallaby@1.6.27:
|
||||
version "1.6.27"
|
||||
resolved "https://registry.yarnpkg.com/escodegen-wallaby/-/escodegen-wallaby-1.6.27.tgz#c2d3ca8b6fd4d5f0d3f770f7b1d29b958078fdb2"
|
||||
integrity sha512-DFXbfLTNa/wiQRgqSseKhmzyDhwWJ4c/6IwsdAgA6qYL0ntsmSuuTMovEbA/8oCanSGkUR1qaLsDgKiWPllnjg==
|
||||
escodegen@1.12.1:
|
||||
version "1.12.1"
|
||||
resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.12.1.tgz#08770602a74ac34c7a90ca9229e7d51e379abc76"
|
||||
integrity sha512-Q8t2YZ+0e0pc7NRVj3B4tSQ9rim1oi4Fh46k2xhJ2qOiEwhQfdjyEQddWdj7ZFaKmU+5104vn1qrcjEPWq+bgQ==
|
||||
dependencies:
|
||||
esprima "^2.7.1"
|
||||
estraverse "^1.9.1"
|
||||
esprima "^3.1.3"
|
||||
estraverse "^4.2.0"
|
||||
esutils "^2.0.2"
|
||||
optionator "^0.8.1"
|
||||
optionalDependencies:
|
||||
source-map "~0.2.0"
|
||||
source-map "~0.6.1"
|
||||
|
||||
eslint-scope@^4.0.3:
|
||||
version "4.0.3"
|
||||
@@ -1591,10 +1586,10 @@ espree@6.1.2:
|
||||
acorn-jsx "^5.1.0"
|
||||
eslint-visitor-keys "^1.1.0"
|
||||
|
||||
esprima@^2.7.1:
|
||||
version "2.7.3"
|
||||
resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581"
|
||||
integrity sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=
|
||||
esprima@^3.1.3:
|
||||
version "3.1.3"
|
||||
resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633"
|
||||
integrity sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=
|
||||
|
||||
esprima@^4.0.0:
|
||||
version "4.0.1"
|
||||
@@ -1608,16 +1603,11 @@ esrecurse@^4.1.0:
|
||||
dependencies:
|
||||
estraverse "^4.1.0"
|
||||
|
||||
estraverse@4.3.0, estraverse@^4.1.0, estraverse@^4.1.1:
|
||||
estraverse@4.3.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0:
|
||||
version "4.3.0"
|
||||
resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d"
|
||||
integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==
|
||||
|
||||
estraverse@^1.9.1:
|
||||
version "1.9.3"
|
||||
resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-1.9.3.tgz#af67f2dc922582415950926091a4005d29c9bb44"
|
||||
integrity sha1-r2fy3JIlgkFZUJJgkaQAXSnJu0Q=
|
||||
|
||||
esutils@^1.1.6:
|
||||
version "1.1.6"
|
||||
resolved "https://registry.yarnpkg.com/esutils/-/esutils-1.1.6.tgz#c01ccaa9ae4b897c6d0c3e210ae52f3c7a844375"
|
||||
@@ -3888,13 +3878,6 @@ source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1:
|
||||
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
|
||||
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
|
||||
|
||||
source-map@~0.2.0:
|
||||
version "0.2.0"
|
||||
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.2.0.tgz#dab73fbcfc2ba819b4de03bd6f6eaa48164b3f9d"
|
||||
integrity sha1-2rc/vPwrqBm03gO9b26qSBZLP50=
|
||||
dependencies:
|
||||
amdefine ">=0.0.4"
|
||||
|
||||
spawn-sync@^1.0.15:
|
||||
version "1.0.15"
|
||||
resolved "https://registry.yarnpkg.com/spawn-sync/-/spawn-sync-1.0.15.tgz#b00799557eb7fb0c8376c29d44e8a1ea67e57476"
|
||||
@@ -4145,9 +4128,9 @@ terser-webpack-plugin@^1.4.3:
|
||||
worker-farm "^1.7.0"
|
||||
|
||||
terser@^4.1.2:
|
||||
version "4.4.3"
|
||||
resolved "https://registry.yarnpkg.com/terser/-/terser-4.4.3.tgz#401abc52b88869cf904412503b1eb7da093ae2f0"
|
||||
integrity sha512-0ikKraVtRDKGzHrzkCv5rUNDzqlhmhowOBqC0XqUHFpW+vJ45+20/IFBcebwKfiS2Z9fJin6Eo+F1zLZsxi8RA==
|
||||
version "4.5.1"
|
||||
resolved "https://registry.yarnpkg.com/terser/-/terser-4.5.1.tgz#63b52d6b6ce344aa6fedcd0ee06a695799eb50bd"
|
||||
integrity sha512-lH9zLIbX8PRBEFCTvfHGCy0s9HEKnNso1Dx9swSopF3VUnFLB8DpQ61tHxoofovNC/sG0spajJM3EIIRSTByiQ==
|
||||
dependencies:
|
||||
commander "^2.20.0"
|
||||
source-map "~0.6.1"
|
||||
|
||||
Reference in New Issue
Block a user