Skip to content
This repository was archived by the owner on Dec 9, 2025. It is now read-only.

Commit 9ddfb09

Browse files
committed
Updated to use the javascript-obfuscator@0.14.2 which includes two new options: 'identifiersPrefix' and 'transformObjectKeys'.
1 parent 1233bc0 commit 9ddfb09

File tree

7 files changed

+117
-57
lines changed

7 files changed

+117
-57
lines changed

App/actions/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,8 @@ export const setIdentifierNamesGenerator = (identifierNamesGenerator) => ({
102102
'type': types.SET_IDENTIFIER_NAMES_GENERATOR,
103103
identifierNamesGenerator
104104
});
105+
106+
export const setIdentifiersPrefix = (identifiersPrefix) => ({
107+
'type': types.SET_IDENTIFIERS_PREFIX,
108+
identifiersPrefix
109+
});

App/constants/ActionTypes.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,7 @@ export const TOGGLE_RENAME_GLOBALS = 'TOGGLE_RENAME_GLOBALS'
4343
export const SET_TARGET = 'SET_TARGET'
4444

4545
export const SET_IDENTIFIER_NAMES_GENERATOR = 'SET_IDENTIFER_NAMES_GENERATOR'
46+
47+
export const SET_IDENTIFIERS_PREFIX = 'SET_IDENTIFIERS_PREFIX'
48+
49+
export const TOGGLE_TRANSFORM_OBJECT_KEYS = 'TOGGLE_TRANSFORM_OBJECT_KEYS'

App/containers/OptionsContainer.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ const Options = ({dispatch, options}) =>
6262
onChange={(event, {value}) => dispatch(actions.setIdentifierNamesGenerator(value)) }
6363
options={IDENTIFIER_NAMES_GENERATOR_OPTIONS} />
6464

65+
<Form.Input
66+
label='Identifiers Prefix'
67+
onBlur={(event) => dispatch(actions.setIdentifiersPrefix(event.target.value)) }
68+
defaultValue={options.identifiersPrefix}
69+
placeholder='' />
70+
6571
<Form.Checkbox
6672
label='Rename Globals'
6773
checked={options.renameGlobals}
@@ -145,6 +151,13 @@ const Options = ({dispatch, options}) =>
145151

146152
<Divider />
147153

154+
<Form.Checkbox
155+
label='Transform Object Keys'
156+
checked={options.transformObjectKeys}
157+
onChange={() => dispatch(actions.toggleOption(types.TOGGLE_TRANSFORM_OBJECT_KEYS)) } />
158+
159+
<Divider />
160+
148161
<Form.Checkbox
149162
label='Unicode Escape Sequence'
150163
checked={options.unicodeEscapeSequence}

App/reducers/options.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ const initialState = {
4545
target: 'browser',
4646

4747
identifierNamesGenerator: 'hexadecimal',
48+
identifiersPrefix: '',
49+
50+
transformObjectKeys: false,
4851

4952
}
5053

@@ -247,6 +250,18 @@ export const options = (state = initialState, action) => {
247250
identifierNamesGenerator: action.identifierNamesGenerator
248251
}
249252

253+
case types.SET_IDENTIFIERS_PREFIX:
254+
return {
255+
...state,
256+
identifiersPrefix: action.identifiersPrefix
257+
}
258+
259+
case types.TOGGLE_TRANSFORM_OBJECT_KEYS:
260+
return {
261+
...state,
262+
transformObjectKeys: !state.transformObjectKeys
263+
}
264+
250265
default:
251266
return state
252267
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"extract-text-webpack-plugin": "^2.0.0-beta",
3131
"graceful-fs": "^4.1.9",
3232
"inert": "^4.0.2",
33-
"javascript-obfuscator": "^0.13.0",
33+
"javascript-obfuscator": "^0.14.2",
3434
"less": "^2.7.1",
3535
"less-loader": "^2.2.3",
3636
"react": "^15.3.1",

templates/index.html

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ <h3>Sounds great!</h3>
9494
</td>
9595
</tr>
9696

97+
<tr>
98+
<td class="collapsing">Identifiers Prefix</td>
99+
<td>
100+
<p>This options makes all obfuscated identifiers have a specific prefix.</p>
101+
<p>Use this option when obfuscating multiple files that are loaded on the same page. This option helps to avoid conflicts between global identifiers of these files. Use a different prefix for each file.</p>
102+
</td>
103+
</tr>
104+
97105
<tr>
98106
<td class="collapsing">Rename Globals</td>
99107
<td>
@@ -150,7 +158,7 @@ <h3>Sounds great!</h3>
150158
</div>
151159

152160
<p>
153-
This feature adds random blocks of dead code (i.e: code that won't be executed) to the obfuscated output, making it harder to be reverserd-engineered. See the docs on <a href="https://github.com/javascript-obfuscator/javascript-obfuscator#deadcodeinjection" target="_new">JavaScript's obfuscator GH page</a> for an example of how this feature works.
161+
This feature adds random blocks of dead code (i.e: code that won't be executed) to the obfuscated output, making it harder to be reverserd-engineered. See the docs on <a href="https://github.com/javascript-obfuscator/javascript-obfuscator#deadcodeinjection" target="_new">JavaScript Obfuscator's GH page</a> for an example of how this feature works.
154162
</p>
155163

156164
<table class="ui definition table">
@@ -216,6 +224,16 @@ <h3>Sounds great!</h3>
216224
</td>
217225
</tr>
218226

227+
<tr>
228+
<td class="collapsing">Transform Object Keys</td>
229+
<td>
230+
<p>Transforms (obfuscates) object keys.</p>
231+
<p>For instance, this code <code>var a = {enabled: true};</code> when obfuscated with this option will hide the <code>enabled</code> object key: <code>var a = {}; a[_0x2ae0[('0x0')] = true;</code>.</p>
232+
<p>See the <a href="https://github.com/javascript-obfuscator/javascript-obfuscator#transformobjectkeys" target="_new">official documentation of the JavaScript Obfuscator on GitHub</a> for a full example.</p>
233+
<p><small>ideally used with the <strong>String Array</strong> setting.</small></p>
234+
</td>
235+
</tr>
236+
219237
<tr>
220238
<td class="collapsing">Escape Unicode Sequence</td>
221239
<td>

yarn.lock

Lines changed: 60 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ ansi-styles@^2.2.1:
8181
version "2.2.1"
8282
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"
8383

84-
ansi-styles@^3.1.0:
84+
ansi-styles@^3.2.0:
8585
version "3.2.0"
8686
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88"
8787
dependencies:
@@ -1135,17 +1135,17 @@ chalk@1.1.3, chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3:
11351135
strip-ansi "^3.0.0"
11361136
supports-color "^2.0.0"
11371137

1138-
chalk@2.3.0:
1139-
version "2.3.0"
1140-
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.0.tgz#b5ea48efc9c1793dccc9b4767c93914d3f2d52ba"
1138+
chalk@2.3.1:
1139+
version "2.3.1"
1140+
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.1.tgz#523fe2678aec7b04e8041909292fe8b17059b796"
11411141
dependencies:
1142-
ansi-styles "^3.1.0"
1142+
ansi-styles "^3.2.0"
11431143
escape-string-regexp "^1.0.5"
1144-
supports-color "^4.0.0"
1144+
supports-color "^5.2.0"
11451145

1146-
chance@1.0.12:
1147-
version "1.0.12"
1148-
resolved "https://registry.yarnpkg.com/chance/-/chance-1.0.12.tgz#6764c9cb7b4f34856fb780d07f0e17a6601c6c08"
1146+
chance@1.0.13:
1147+
version "1.0.13"
1148+
resolved "https://registry.yarnpkg.com/chance/-/chance-1.0.13.tgz#666bec2db42b3084456a3e4f4c28a82db5ccb7e6"
11491149

11501150
charenc@~0.0.1:
11511151
version "0.0.2"
@@ -1182,11 +1182,11 @@ clap@^1.0.9:
11821182
dependencies:
11831183
chalk "^1.1.3"
11841184

1185-
class-validator@0.7.3:
1186-
version "0.7.3"
1187-
resolved "https://registry.yarnpkg.com/class-validator/-/class-validator-0.7.3.tgz#3c2821b8cf35fd8d5f4fcb8063bc57fb50049e7e"
1185+
class-validator@0.8.1:
1186+
version "0.8.1"
1187+
resolved "https://registry.yarnpkg.com/class-validator/-/class-validator-0.8.1.tgz#f5efd5c613927e3c2f68692e8f14d53a2644fb2f"
11881188
dependencies:
1189-
validator "^7.0.0"
1189+
validator "9.2.0"
11901190

11911191
classnames@^2.1.5, classnames@^2.2.3, classnames@^2.2.5:
11921192
version "2.2.5"
@@ -1298,9 +1298,9 @@ combined-stream@^1.0.5, combined-stream@~1.0.5:
12981298
dependencies:
12991299
delayed-stream "~1.0.0"
13001300

1301-
commander@2.12.2:
1302-
version "2.12.2"
1303-
resolved "https://registry.yarnpkg.com/commander/-/commander-2.12.2.tgz#0f5946c427ed9ec0d91a46bb9def53e54650e555"
1301+
commander@2.14.1:
1302+
version "2.14.1"
1303+
resolved "https://registry.yarnpkg.com/commander/-/commander-2.14.1.tgz#2235123e37af8ca3c65df45b026dbd357b01b9aa"
13041304

13051305
commander@^2.9.0:
13061306
version "2.9.0"
@@ -1709,9 +1709,9 @@ escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
17091709
version "1.0.5"
17101710
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
17111711

1712-
escodegen-wallaby@1.6.15:
1713-
version "1.6.15"
1714-
resolved "https://registry.yarnpkg.com/escodegen-wallaby/-/escodegen-wallaby-1.6.15.tgz#9d5ef67dd4d8c7c8a58aff1e4edd63512566ba9f"
1712+
escodegen-wallaby@1.6.17:
1713+
version "1.6.17"
1714+
resolved "https://registry.yarnpkg.com/escodegen-wallaby/-/escodegen-wallaby-1.6.17.tgz#3e1f334884d4214c94309cf734ec7cfa0b3d438d"
17151715
dependencies:
17161716
esprima "^2.7.1"
17171717
estraverse "^1.9.1"
@@ -2168,9 +2168,9 @@ has-flag@^1.0.0:
21682168
version "1.0.0"
21692169
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa"
21702170

2171-
has-flag@^2.0.0:
2172-
version "2.0.0"
2173-
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51"
2171+
has-flag@^3.0.0:
2172+
version "3.0.0"
2173+
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"
21742174

21752175
has-unicode@^2.0.0:
21762176
version "2.0.1"
@@ -2367,9 +2367,9 @@ invariant@^2.0.0, invariant@^2.2.0:
23672367
dependencies:
23682368
loose-envify "^1.0.0"
23692369

2370-
inversify@4.8.0:
2371-
version "4.8.0"
2372-
resolved "https://registry.yarnpkg.com/inversify/-/inversify-4.8.0.tgz#750c3c204ee9fe9a7529062dc6196c69d05fee7e"
2370+
inversify@^4.10.0:
2371+
version "4.10.0"
2372+
resolved "https://registry.yarnpkg.com/inversify/-/inversify-4.10.0.tgz#06b97792e69220dd150b986cde9a445b3bcb9482"
23732373

23742374
invert-kv@^1.0.0:
23752375
version "1.0.0"
@@ -2551,26 +2551,27 @@ items@2.x.x:
25512551
version "2.1.1"
25522552
resolved "https://registry.yarnpkg.com/items/-/items-2.1.1.tgz#8bd16d9c83b19529de5aea321acaada78364a198"
25532553

2554-
javascript-obfuscator@^0.13.0:
2555-
version "0.13.0"
2556-
resolved "https://registry.yarnpkg.com/javascript-obfuscator/-/javascript-obfuscator-0.13.0.tgz#a6dadad98a602f9e0917ab42ec9f6e3f6def1da8"
2554+
javascript-obfuscator@^0.14.2:
2555+
version "0.14.2"
2556+
resolved "https://registry.yarnpkg.com/javascript-obfuscator/-/javascript-obfuscator-0.14.2.tgz#653066652e15427a3f2d804bd53fbfcabefbdd3b"
25572557
dependencies:
2558-
chalk "2.3.0"
2559-
chance "1.0.12"
2560-
class-validator "0.7.3"
2561-
commander "2.12.2"
2562-
escodegen-wallaby "1.6.15"
2558+
chalk "2.3.1"
2559+
chance "1.0.13"
2560+
class-validator "0.8.1"
2561+
commander "2.14.1"
2562+
escodegen-wallaby "1.6.17"
25632563
esprima "4.0.0"
25642564
estraverse "4.2.0"
2565-
inversify "4.8.0"
2565+
inversify "^4.10.0"
2566+
js-string-escape "1.0.1"
25662567
md5 "2.2.1"
25672568
mkdirp "0.5.1"
25682569
opencollective "1.0.3"
2569-
pjson "^1.0.9"
2570-
reflect-metadata "0.1.10"
2571-
source-map-support "0.5.0"
2570+
pjson "1.0.9"
2571+
reflect-metadata "0.1.12"
2572+
source-map-support "0.5.3"
25722573
string-template "1.0.0"
2573-
tslib "1.8.1"
2574+
tslib "1.9.0"
25742575

25752576
jodid25519@^1.0.0:
25762577
version "1.0.2"
@@ -2596,6 +2597,10 @@ js-base64@^2.1.9:
25962597
version "2.1.9"
25972598
resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.1.9.tgz#f0e80ae039a4bd654b5f281fc93f04a914a7fcce"
25982599

2600+
js-string-escape@1.0.1:
2601+
version "1.0.1"
2602+
resolved "https://registry.yarnpkg.com/js-string-escape/-/js-string-escape-1.0.1.tgz#e2625badbc0d67c7533e9edc1068c587ae4137ef"
2603+
25992604
js-tokens@^1.0.1:
26002605
version "1.0.3"
26012606
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-1.0.3.tgz#14e56eb68c8f1a92c43d59f5014ec29dc20f2ae1"
@@ -3221,7 +3226,7 @@ pinkie@^2.0.0:
32213226
version "2.0.4"
32223227
resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870"
32233228

3224-
pjson@^1.0.9:
3229+
pjson@1.0.9:
32253230
version "1.0.9"
32263231
resolved "https://registry.yarnpkg.com/pjson/-/pjson-1.0.9.tgz#8a9520ce76a4739f8fee91679dad6b065b1c7938"
32273232

@@ -3715,9 +3720,9 @@ redux@^3.6.0:
37153720
loose-envify "^1.1.0"
37163721
symbol-observable "^1.0.2"
37173722

3718-
reflect-metadata@0.1.10:
3719-
version "0.1.10"
3720-
resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.1.10.tgz#b4f83704416acad89988c9b15635d47e03b9344a"
3723+
reflect-metadata@0.1.12:
3724+
version "0.1.12"
3725+
resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.1.12.tgz#311bf0c6b63cd782f228a81abe146a2bfa9c56f2"
37213726

37223727
regenerate@^1.2.1:
37233728
version "1.3.1"
@@ -3980,9 +3985,9 @@ source-list-map@^0.1.4, source-list-map@~0.1.0:
39803985
version "0.1.6"
39813986
resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-0.1.6.tgz#e1e6f94f0b40c4d28dcf8f5b8766e0e45636877f"
39823987

3983-
source-map-support@0.5.0:
3984-
version "0.5.0"
3985-
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.0.tgz#2018a7ad2bdf8faf2691e5fddab26bed5a2bacab"
3988+
source-map-support@0.5.3:
3989+
version "0.5.3"
3990+
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.3.tgz#2b3d5fff298cfa4d1afd7d4352d569e9a0158e76"
39863991
dependencies:
39873992
source-map "^0.6.0"
39883993

@@ -4123,11 +4128,11 @@ supports-color@^3.1.0, supports-color@^3.1.2:
41234128
dependencies:
41244129
has-flag "^1.0.0"
41254130

4126-
supports-color@^4.0.0:
4127-
version "4.4.0"
4128-
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.4.0.tgz#883f7ddabc165142b2a61427f3352ded195d1a3e"
4131+
supports-color@^5.2.0:
4132+
version "5.2.0"
4133+
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.2.0.tgz#b0d5333b1184dd3666cbe5aa0b45c5ac7ac17a4a"
41294134
dependencies:
4130-
has-flag "^2.0.0"
4135+
has-flag "^3.0.0"
41314136

41324137
svgo@^0.7.0:
41334138
version "0.7.1"
@@ -4219,9 +4224,9 @@ tryit@^1.0.1:
42194224
version "1.0.2"
42204225
resolved "https://registry.yarnpkg.com/tryit/-/tryit-1.0.2.tgz#c196b0073e6b1c595d93c9c830855b7acc32a453"
42214226

4222-
tslib@1.8.1:
4223-
version "1.8.1"
4224-
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.8.1.tgz#6946af2d1d651a7b1863b531d6e5afa41aa44eac"
4227+
tslib@1.9.0:
4228+
version "1.9.0"
4229+
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8"
42254230

42264231
tty-browserify@0.0.0:
42274232
version "0.0.0"
@@ -4336,9 +4341,9 @@ validate-npm-package-license@^3.0.1:
43364341
spdx-correct "~1.0.0"
43374342
spdx-expression-parse "~1.0.0"
43384343

4339-
validator@^7.0.0:
4340-
version "7.2.0"
4341-
resolved "https://registry.yarnpkg.com/validator/-/validator-7.2.0.tgz#a63dcbaba51d4350bf8df20988e0d5a54d711791"
4344+
validator@9.2.0:
4345+
version "9.2.0"
4346+
resolved "https://registry.yarnpkg.com/validator/-/validator-9.2.0.tgz#ad216eed5f37cac31a6fe00ceab1f6b88bded03e"
43424347

43434348
vary@~1.1.0:
43444349
version "1.1.0"

0 commit comments

Comments
 (0)