mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
Merge pull request #150 from javascript-obfuscator/issue-149
Fixed #149
This commit is contained in:
@@ -2,7 +2,6 @@ sudo: false
|
||||
language: node_js
|
||||
|
||||
node_js:
|
||||
- "4.3.0"
|
||||
- "4"
|
||||
- "5"
|
||||
- "6"
|
||||
|
||||
+3
-2
@@ -7,14 +7,15 @@ v0.13.0
|
||||
* **Breaking change:** all CLI options were renamed to `kebab-case` format (`--disableConsoleOutout` -> `--disable-console-output`).
|
||||
* Implemented custom `mangle` option algorithm without `esmangle`; fixed https://github.com/javascript-obfuscator/javascript-obfuscator/issues/110
|
||||
* Comments with `@license`, `@preserve` and `javascript-obfuscator` words won't be removed from obfuscated code.
|
||||
* Fixed https://github.com/javascript-obfuscator/javascript-obfuscator/issues/149
|
||||
|
||||
v0.12.5
|
||||
---
|
||||
* https://github.com/javascript-obfuscator/javascript-obfuscator/issues/139
|
||||
* Fixed https://github.com/javascript-obfuscator/javascript-obfuscator/issues/139
|
||||
|
||||
v0.12.4
|
||||
---
|
||||
* https://github.com/javascript-obfuscator/javascript-obfuscator/issues/136
|
||||
* Fixed https://github.com/javascript-obfuscator/javascript-obfuscator/issues/136
|
||||
|
||||
v0.12.3
|
||||
---
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+6
-6
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "javascript-obfuscator",
|
||||
"version": "0.13.0-dev.3",
|
||||
"version": "0.13.0-dev.4",
|
||||
"description": "JavaScript obfuscator",
|
||||
"keywords": [
|
||||
"obfuscator",
|
||||
@@ -12,7 +12,7 @@
|
||||
"js obfuscator"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=4.3.0"
|
||||
"node": ">=4.8.0"
|
||||
},
|
||||
"main": "dist/index.js",
|
||||
"bin": {
|
||||
@@ -37,7 +37,7 @@
|
||||
"tslib": "1.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/chai": "4.0.9",
|
||||
"@types/chai": "4.0.10",
|
||||
"@types/chance": "0.7.35",
|
||||
"@types/commander": "2.12.2",
|
||||
"@types/escodegen": "0.0.6",
|
||||
@@ -47,8 +47,8 @@
|
||||
"@types/md5": "2.1.32",
|
||||
"@types/mkdirp": "0.5.2",
|
||||
"@types/mocha": "2.2.44",
|
||||
"@types/node": "8.0.58",
|
||||
"@types/sinon": "4.1.0",
|
||||
"@types/node": "8.5.0",
|
||||
"@types/sinon": "4.1.2",
|
||||
"@types/string-template": "1.0.2",
|
||||
"@types/webpack-env": "1.13.3",
|
||||
"awesome-typescript-loader": "3.4.1",
|
||||
@@ -63,7 +63,7 @@
|
||||
"pre-commit": "1.2.2",
|
||||
"sinon": "4.1.3",
|
||||
"threads": "^0.10.0",
|
||||
"ts-node": "3.3.0",
|
||||
"ts-node": "4.0.1",
|
||||
"tslint": "5.8.0",
|
||||
"tslint-eslint-rules": "4.1.1",
|
||||
"tslint-language-service": "0.9.7",
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
$(yarn bin)/ts-node test/dev/dev.ts
|
||||
$(yarn bin)/ts-node --type-check test/dev/dev.ts
|
||||
@@ -228,17 +228,20 @@ export class NodeGuards {
|
||||
return false;
|
||||
}
|
||||
|
||||
const parentNodeIsPropertyNode: boolean = NodeGuards.isPropertyNode(parentNode)
|
||||
&& !parentNode.computed
|
||||
&& parentNode.key === node;
|
||||
const parentNodeIsPropertyNode: boolean = NodeGuards.isPropertyNode(parentNode) &&
|
||||
!parentNode.computed &&
|
||||
parentNode.key === node;
|
||||
const parentNodeIsMemberExpressionNode: boolean = (
|
||||
NodeGuards.isMemberExpressionNode(parentNode) &&
|
||||
parentNode.computed === false &&
|
||||
parentNode.property === node
|
||||
);
|
||||
const parentNodeIsMethodDefinitionNode: boolean = NodeGuards.isMethodDefinitionNode(parentNode) &&
|
||||
!parentNode.computed;
|
||||
|
||||
return !parentNodeIsPropertyNode &&
|
||||
!parentNodeIsMemberExpressionNode &&
|
||||
!parentNodeIsMethodDefinitionNode &&
|
||||
!NodeGuards.isLabelIdentifierNode(node, parentNode);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ import { NO_CUSTOM_NODES_PRESET } from '../../src/options/presets/NoCustomNodes'
|
||||
{
|
||||
...NO_CUSTOM_NODES_PRESET,
|
||||
compact: false,
|
||||
identifierNamesGenerator: 'mangled'
|
||||
}
|
||||
).getObfuscatedCode();
|
||||
|
||||
|
||||
+3
-2
@@ -9,14 +9,13 @@ import { readFileAsString } from '../../../../helpers/readFileAsString';
|
||||
import { JavaScriptObfuscator } from '../../../../../src/JavaScriptObfuscatorFacade';
|
||||
|
||||
describe('MethodDefinitionTransformer', () => {
|
||||
const code: string = readFileAsString(__dirname + '/fixtures/input.js');
|
||||
|
||||
describe('variant #1: default behaviour', () => {
|
||||
const regExp: RegExp = /\['bar'\]\(\)\{\}/;
|
||||
|
||||
let obfuscatedCode: string;
|
||||
|
||||
before(() => {
|
||||
const code: string = readFileAsString(__dirname + '/fixtures/sample-input.js');
|
||||
const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
|
||||
code,
|
||||
{
|
||||
@@ -39,6 +38,7 @@ describe('MethodDefinitionTransformer', () => {
|
||||
let obfuscatedCode: string;
|
||||
|
||||
before(() => {
|
||||
const code: string = readFileAsString(__dirname + '/fixtures/sample-input.js');
|
||||
const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
|
||||
code,
|
||||
{
|
||||
@@ -66,6 +66,7 @@ describe('MethodDefinitionTransformer', () => {
|
||||
let obfuscatedCode: string;
|
||||
|
||||
before(() => {
|
||||
const code: string = readFileAsString(__dirname + '/fixtures/sample-input.js');
|
||||
const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
|
||||
code,
|
||||
{
|
||||
|
||||
+1
-1
@@ -280,7 +280,7 @@ describe('DeadCodeInjectionTransformer', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('variant #7- chance of `IfStatement` variant', () => {
|
||||
describe('variant #7 - chance of `IfStatement` variant', () => {
|
||||
const samplesCount: number = 1000;
|
||||
const delta: number = 0.1;
|
||||
const expectedDistribution: number = 0.25;
|
||||
|
||||
+22
@@ -413,4 +413,26 @@ describe('VariableDeclarationTransformer', () => {
|
||||
assert.match(obfuscatedCode, computedObjectExpressionRegExp);
|
||||
});
|
||||
});
|
||||
|
||||
describe('variant #12: method definition key identifier', () => {
|
||||
const regExp: RegExp = /\['bar'] *\(\) *{}/;
|
||||
|
||||
let obfuscatedCode: string;
|
||||
|
||||
before(() => {
|
||||
const code: string = readFileAsString(__dirname + '/fixtures/method-definition-identifier.js');
|
||||
const obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
|
||||
code,
|
||||
{
|
||||
...NO_CUSTOM_NODES_PRESET
|
||||
}
|
||||
);
|
||||
|
||||
obfuscatedCode = obfuscationResult.getObfuscatedCode();
|
||||
});
|
||||
|
||||
it('shouldn\'t transform method definition node key identifier', () => {
|
||||
assert.match(obfuscatedCode, regExp);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
(function () {
|
||||
var bar = 1;
|
||||
|
||||
class Foo {
|
||||
bar() {}
|
||||
}
|
||||
})();
|
||||
@@ -2,9 +2,13 @@
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@types/chai@4.0.9":
|
||||
version "4.0.9"
|
||||
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.0.9.tgz#9897c0ca23acb117f8b4e3af2c81d85cccdd9bc0"
|
||||
"@types/arrify@^1.0.1":
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/arrify/-/arrify-1.0.2.tgz#4a6856b9bfd4713c781df95349c6b15db60d4de1"
|
||||
|
||||
"@types/chai@4.0.10":
|
||||
version "4.0.10"
|
||||
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.0.10.tgz#0eb222c7353adde8e0980bea04165d4d3b6afef3"
|
||||
|
||||
"@types/chance@0.7.35":
|
||||
version "0.7.35"
|
||||
@@ -16,6 +20,10 @@
|
||||
dependencies:
|
||||
commander "*"
|
||||
|
||||
"@types/diff@^3.2.1":
|
||||
version "3.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/diff/-/diff-3.2.2.tgz#4d6f45537322a7a420d353a0939513c7e96d14a6"
|
||||
|
||||
"@types/escodegen@0.0.6":
|
||||
version "0.0.6"
|
||||
resolved "https://registry.yarnpkg.com/@types/escodegen/-/escodegen-0.0.6.tgz#5230a9ce796e042cda6f086dbf19f22ea330659c"
|
||||
@@ -42,7 +50,11 @@
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/mkdirp@0.5.2":
|
||||
"@types/minimist@^1.2.0":
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.0.tgz#69a23a3ad29caf0097f06eda59b361ee2f0639f6"
|
||||
|
||||
"@types/mkdirp@0.5.2", "@types/mkdirp@^0.5.0":
|
||||
version "0.5.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/mkdirp/-/mkdirp-0.5.2.tgz#503aacfe5cc2703d5484326b1b27efa67a339c1f"
|
||||
dependencies:
|
||||
@@ -56,22 +68,44 @@
|
||||
version "8.0.53"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.53.tgz#396b35af826fa66aad472c8cb7b8d5e277f4e6d8"
|
||||
|
||||
"@types/node@8.0.58":
|
||||
version "8.0.58"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.58.tgz#5b3881c0be3a646874803fee3197ea7f1ed6df90"
|
||||
"@types/node@8.5.0", "@types/node@^8.0.27":
|
||||
version "8.5.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.5.0.tgz#c5be22ffc84b221466fc8dfc0d6b1f88060808ef"
|
||||
|
||||
"@types/sinon@4.1.0":
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-4.1.0.tgz#cdfb934d656b2c888e51f53e95900c7bbca11c08"
|
||||
"@types/sinon@4.1.2":
|
||||
version "4.1.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-4.1.2.tgz#9085db9cc3288b0f12daceee20a26c4afd9c2dcd"
|
||||
|
||||
"@types/source-map-support@^0.4.0":
|
||||
version "0.4.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/source-map-support/-/source-map-support-0.4.0.tgz#a62a1866614af68c888173c001481f242aaf148b"
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/string-template@1.0.2":
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/string-template/-/string-template-1.0.2.tgz#363b273c9b456705e3111e3571e9248f6474eba4"
|
||||
|
||||
"@types/strip-bom@^3.0.0":
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/strip-bom/-/strip-bom-3.0.0.tgz#14a8ec3956c2e81edb7520790aecf21c290aebd2"
|
||||
|
||||
"@types/strip-json-comments@0.0.30":
|
||||
version "0.0.30"
|
||||
resolved "https://registry.yarnpkg.com/@types/strip-json-comments/-/strip-json-comments-0.0.30.tgz#9aa30c04db212a9a0649d6ae6fd50accc40748a1"
|
||||
|
||||
"@types/v8flags@github:types/npm-v8flags#de224ae1cd5fd7dbb4e7158a6cc7a29e5315930d":
|
||||
version "2.0.0"
|
||||
resolved "https://codeload.github.com/types/npm-v8flags/tar.gz/de224ae1cd5fd7dbb4e7158a6cc7a29e5315930d"
|
||||
|
||||
"@types/webpack-env@1.13.3":
|
||||
version "1.13.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/webpack-env/-/webpack-env-1.13.3.tgz#0ecbe70f87341767793774d3683b51aa3246434c"
|
||||
|
||||
"@types/yn@github:types/npm-yn#ca75f6c82940fae6a06fb41d2d37a6aa9b4ea8e9":
|
||||
version "2.0.0"
|
||||
resolved "https://codeload.github.com/types/npm-yn/tar.gz/ca75f6c82940fae6a06fb41d2d37a6aa9b4ea8e9"
|
||||
|
||||
abbrev@1, abbrev@1.0.x:
|
||||
version "1.0.9"
|
||||
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.0.9.tgz#91b4792588a7738c25f35dd6f63752a2f8776135"
|
||||
@@ -939,7 +973,7 @@ chalk@1.1.3, chalk@^1.0.0, chalk@^1.1.3:
|
||||
strip-ansi "^3.0.0"
|
||||
supports-color "^2.0.0"
|
||||
|
||||
chalk@2.3.0, chalk@^2.0.0, chalk@^2.1.0:
|
||||
chalk@2.3.0, chalk@^2.1.0, chalk@^2.3.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.0.tgz#b5ea48efc9c1793dccc9b4767c93914d3f2d52ba"
|
||||
dependencies:
|
||||
@@ -3359,13 +3393,13 @@ source-map-resolve@^0.5.0:
|
||||
source-map-url "^0.4.0"
|
||||
urix "^0.1.0"
|
||||
|
||||
source-map-support@0.5.0:
|
||||
source-map-support@0.5.0, source-map-support@^0.5.0:
|
||||
version "0.5.0"
|
||||
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.0.tgz#2018a7ad2bdf8faf2691e5fddab26bed5a2bacab"
|
||||
dependencies:
|
||||
source-map "^0.6.0"
|
||||
|
||||
source-map-support@^0.4.0, source-map-support@^0.4.15:
|
||||
source-map-support@^0.4.15:
|
||||
version "0.4.18"
|
||||
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.18.tgz#0286a6de8be42641338594e97ccea75f0a2c585f"
|
||||
dependencies:
|
||||
@@ -3640,25 +3674,35 @@ trim-right@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003"
|
||||
|
||||
ts-node@3.3.0:
|
||||
version "3.3.0"
|
||||
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-3.3.0.tgz#c13c6a3024e30be1180dd53038fc209289d4bf69"
|
||||
ts-node@4.0.1:
|
||||
version "4.0.1"
|
||||
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-4.0.1.tgz#4d368088b50c382d78285c029784ea0f32a4eb5c"
|
||||
dependencies:
|
||||
"@types/arrify" "^1.0.1"
|
||||
"@types/diff" "^3.2.1"
|
||||
"@types/minimist" "^1.2.0"
|
||||
"@types/mkdirp" "^0.5.0"
|
||||
"@types/node" "^8.0.27"
|
||||
"@types/source-map-support" "^0.4.0"
|
||||
"@types/v8flags" types/npm-v8flags#de224ae1cd5fd7dbb4e7158a6cc7a29e5315930d
|
||||
"@types/yn" types/npm-yn#ca75f6c82940fae6a06fb41d2d37a6aa9b4ea8e9
|
||||
arrify "^1.0.0"
|
||||
chalk "^2.0.0"
|
||||
chalk "^2.3.0"
|
||||
diff "^3.1.0"
|
||||
make-error "^1.1.1"
|
||||
minimist "^1.2.0"
|
||||
mkdirp "^0.5.1"
|
||||
source-map-support "^0.4.0"
|
||||
tsconfig "^6.0.0"
|
||||
source-map-support "^0.5.0"
|
||||
tsconfig "^7.0.0"
|
||||
v8flags "^3.0.0"
|
||||
yn "^2.0.0"
|
||||
|
||||
tsconfig@^6.0.0:
|
||||
version "6.0.0"
|
||||
resolved "https://registry.yarnpkg.com/tsconfig/-/tsconfig-6.0.0.tgz#6b0e8376003d7af1864f8df8f89dd0059ffcd032"
|
||||
tsconfig@^7.0.0:
|
||||
version "7.0.0"
|
||||
resolved "https://registry.yarnpkg.com/tsconfig/-/tsconfig-7.0.0.tgz#84538875a4dc216e5c4a5432b3a4dec3d54e91b7"
|
||||
dependencies:
|
||||
"@types/strip-bom" "^3.0.0"
|
||||
"@types/strip-json-comments" "0.0.30"
|
||||
strip-bom "^3.0.0"
|
||||
strip-json-comments "^2.0.0"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user