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

Commit 37a3fd7

Browse files
committed
Updated to use the javascript-obfuscator@0.13.0 which includes the new 'identifierNamesGenerator' option.
1 parent 4713547 commit 37a3fd7

File tree

7 files changed

+70
-126
lines changed

7 files changed

+70
-126
lines changed

App/actions/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,8 @@ export const setTarget = (target) => ({
9797
'type': types.SET_TARGET,
9898
target
9999
});
100+
101+
export const setIdentifierNamesGenerator = (identifierNamesGenerator) => ({
102+
'type': types.SET_IDENTIFIER_NAMES_GENERATOR,
103+
identifierNamesGenerator
104+
});

App/constants/ActionTypes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ export const TOGGLE_CONTROL_FLOW_FLATTENING = 'TOGGLE_CONTROL_FLOW_FLATTENING'
3636
export const SET_DEAD_CODE_INJECTION_THRESHOLD = 'SET_DEAD_CODE_INJECTION_THRESHOLD'
3737
export const TOGGLE_DEAD_CODE_INJECTION = 'TOGGLE_DEAD_CODE_INJECTION'
3838

39-
export const TOGGLE_MANGLE = 'TOGGLE_MANGLE'
40-
4139
export const TOGGLE_UNICODE_ESCAPE_SEQUENCE = 'TOGGLE_UNICODE_ESCAPE_SEQUENCE'
4240

4341
export const TOGGLE_RENAME_GLOBALS = 'TOGGLE_RENAME_GLOBALS'
4442

4543
export const SET_TARGET = 'SET_TARGET'
44+
45+
export const SET_IDENTIFIER_NAMES_GENERATOR = 'SET_IDENTIFER_NAMES_GENERATOR'

App/containers/OptionsContainer.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ const TARGET_OPTIONS = [
3636
{ text: 'Node', value: TARGET_NODE },
3737
];
3838

39+
export const IDENTIFIER_NAMES_GENERATOR_HEXADECIMAL = 'hexadecimal'
40+
export const IDENTIFIER_NAMES_GENERATOR_MANGLED = 'mangled'
41+
42+
const IDENTIFIER_NAMES_GENERATOR_OPTIONS = [
43+
{ text: 'hexadecimal', value: IDENTIFIER_NAMES_GENERATOR_HEXADECIMAL },
44+
{ text: 'mangled', value: IDENTIFIER_NAMES_GENERATOR_MANGLED },
45+
];
46+
47+
3948
const Options = ({dispatch, options}) =>
4049
<Form className="OptionsForm">
4150
<Grid columns={4} relaxed>
@@ -47,11 +56,6 @@ const Options = ({dispatch, options}) =>
4756
checked={options.compact}
4857
onChange={() => dispatch(actions.toggleOption(types.TOGGLE_COMPACT_CODE)) } />
4958

50-
<Form.Checkbox
51-
label='Mangle Variable Names'
52-
checked={options.mangle}
53-
onChange={() => dispatch(actions.toggleOption(types.TOGGLE_MANGLE)) } />
54-
5559
<Form.Checkbox
5660
label='Rename Globals'
5761
checked={options.renameGlobals}
@@ -140,6 +144,14 @@ const Options = ({dispatch, options}) =>
140144
checked={options.unicodeEscapeSequence}
141145
onChange={() => dispatch(actions.toggleOption(types.TOGGLE_UNICODE_ESCAPE_SEQUENCE)) } />
142146

147+
<Divider />
148+
149+
<Form.Select
150+
label='Identifier Names Generator'
151+
value={options.identifierNamesGenerator}
152+
onChange={(event, {value}) => dispatch(actions.setIdentifierNamesGenerator(value)) }
153+
options={IDENTIFIER_NAMES_GENERATOR_OPTIONS} />
154+
143155
</Segment>
144156
</Grid.Column>
145157

App/reducers/options.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ const initialState = {
3838
deadCodeInjectionThreshold: 0.4,
3939
deadCodeInjection: false,
4040

41-
mangle: false,
42-
4341
unicodeEscapeSequence: false,
4442

4543
renameGlobals: false,
4644

4745
target: 'browser',
4846

47+
identifierNamesGenerator: 'hexadecimal',
48+
4949
}
5050

5151
export const options = (state = initialState, action) => {
@@ -223,12 +223,6 @@ export const options = (state = initialState, action) => {
223223
}
224224
}
225225

226-
case types.TOGGLE_MANGLE:
227-
return {
228-
...state,
229-
mangle: !state.mangle
230-
}
231-
232226
case types.TOGGLE_UNICODE_ESCAPE_SEQUENCE:
233227
return {
234228
...state,
@@ -247,6 +241,12 @@ export const options = (state = initialState, action) => {
247241
target: action.target
248242
}
249243

244+
case types.SET_IDENTIFIER_NAMES_GENERATOR:
245+
return {
246+
...state,
247+
identifierNamesGenerator: action.identifierNamesGenerator
248+
}
249+
250250
default:
251251
return state
252252
}

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.12.5",
33+
"javascript-obfuscator": "^0.13.0",
3434
"less": "^2.7.1",
3535
"less-loader": "^2.2.3",
3636
"react": "^15.3.1",

templates/index.html

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<div class="column">
2828
<div class="ui basic segment">
2929
<h1>JavaScript Obfuscator Tool</h1>
30-
<p>A free and efficient obfuscator for JavaScript (including ES6). Make your code harder to copy and prevent people from stealing your work. This tool is a Web UI to the excellent (and open source) <code><a href="https://github.com/javascript-obfuscator/javascript-obfuscator" target="_new">JavaScript Obfuscator</a>@0.12.5</code> created by Timofey Kachalov.</p>
30+
<p>A free and efficient obfuscator for JavaScript (including ES6). Make your code harder to copy and prevent people from stealing your work. This tool is a Web UI to the excellent (and open source) <code><a href="https://github.com/javascript-obfuscator/javascript-obfuscator" target="_new">JavaScript Obfuscator</a>@0.13.0</code> created by Timofey Kachalov.</p>
3131
</div>
3232
</div>
3333
</div>
@@ -80,13 +80,6 @@ <h3>Sounds great!</h3>
8080
</td>
8181
</tr>
8282

83-
<tr>
84-
<td class="collapsing">Mangle Variable Names</td>
85-
<td>
86-
Mangles the variable names. (For instance, instead of having this random pattern <code>0x123456</code>, they become <code>a</code>, <code>b</code>, and so on.)
87-
</td>
88-
</tr>
89-
9083
<tr>
9184
<td class="collapsing">Rename Globals</td>
9285
<td>
@@ -217,6 +210,21 @@ <h3>Sounds great!</h3>
217210
</td>
218211
</tr>
219212

213+
<tr>
214+
<td class="collapsing">Identifier Names Generator</td>
215+
<td>
216+
<p>Use this option to control how identifiers (variable names, functions names, etc) will be obfuscated.</p>
217+
218+
<strong>hexadecimal</strong>
219+
<p>Generates random identifier names using a hexadecimal pattern (e.g: <code>0xabc123</code>)</p>
220+
221+
<strong>mangled</strong>
222+
<p>Uses short identifier names (e.g: <code>a</code>, <code>b</code>, <code>c</code>, etc.)</p>
223+
224+
</td>
225+
</tr>
226+
227+
220228
<tr>
221229
<td class="collapsing">Disable Console Output</td>
222230
<td>

0 commit comments

Comments
 (0)