8000 * Fixed identifier names generations for `mangled` and `dictionary` i… · sec-js/javascript-obfuscator@945e885 · GitHub
[go: up one dir, main page]

Skip to content

Commit 945e885

Browse files
author
sanex3339
committed
* Fixed identifier names generations for mangled and dictionary identifier names generators
* Fixed combination of `identifierNamesGenerator: dictionary` and `debugProtection` options * `seed` option now accepts `string` and `number` values
1 parent f39d163 commit 945e885

File tree

26 files changed

+272
-22863
lines changed

26 files changed

+272
-22863
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
Change Log
22

3+
v0.20.1
4+
---
5+
* Fixed identifier names generations for `mangled` and `dictionary` identifier names generators
6+
* Fixed combination of `identifierNamesGenerator: dictionary` and `debugProtection` options
7+
* `seed` option now accepts `string` and `number` values
8+
39
v0.20.0
410
---
511
* **Breaking:** dropped support of Node 8 because of end of maintenance support

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ Following options are available for the JS Obfuscator:
343343
--reserved-names '<list>' (comma separated)
344344
--reserved-strings '<list>' (comma separated)
345345
--rotate-string-array <boolean>
346-
--seed <number>
346+
--seed <string|number>
347347
--self-defending <boolean>
348348
--source-map <boolean>
349349
--source-map-base-url <string>
@@ -673,7 +673,7 @@ Shift the `stringArray` array by a fixed and random (generated at the code obfus
673673
This option is recommended if your original source code isn't small, as the helper function can attract attention.
674674

675675
### `seed`
676-
Type: `number` Default: `0`
676+
Type: `string|number` Default: `0`
677677

678678
This option sets seed for random generator. This is useful for creating repeatable results.
679679

dist/index.browser.js

Lines changed: 4 additions & 8000 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.cli.js

Lines changed: 1 addition & 11671 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js

Lines changed: 1 addition & 11080 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "javascript-obfuscator",
3-
"version": "0.20.0",
3+
"version": "0.20.1",
44
"description": "JavaScript obfuscator",
55
"keywords": [
66
"obfuscator",

src/JavaScriptObfuscator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export class JavaScriptObfuscator implements IJavaScriptObfuscator {
127127
const timeStart: number = Date.now();
128128
this.logger.info(LoggingMessage.Version, process.env.VERSION);
129129
this.logger.info(LoggingMessage.ObfuscationStarted);
130-
this.logger.info(LoggingMessage.RandomGeneratorSeed, this.randomGenerator.getSeed());
130+
this.logger.info(LoggingMessage.RandomGeneratorSeed, this.randomGenerator.getInputSeed());
131131

132132
// parse AST tree
133133
const astTree: ESTree.Program = this.parseCode(sourceCode);

src/cli/JavaScriptObfuscatorCLI.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ export class JavaScriptObfuscatorCLI implements IInitializable {
287287
BooleanSanitizer
288288
)
289289
.option(
290-
'--seed <number>',
290+
'--seed <string|number>',
291291
'Sets seed for random generator. This is useful for creating repeatable results.',
292292
parseFloat
293293
)

src/container/modules/generators/GeneratorsModule.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const generatorsModule: interfaces.ContainerModule = new ContainerModule(
2828
.whenTargetNamed(IdentifierNamesGenerator.MangledIdentifierNamesGenerator);
2929

3030
// identifier name generator factory
31-
function identifierNameGeneratorFactory () {
31+
function identifierNameGeneratorFactory (): (context: interfaces.Context) => (options: IOptions) => IIdentifierNamesGenerator {
3232
let cachedIdentifierNamesGenerator: IIdentifierNamesGenerator | null = null;
3333

3434
return (context: interfaces.Context): (options: IOptions) => IIdentifierNamesGenerator => (options: IOptions) => {
@@ -66,7 +66,7 @@ export const generatorsModule: interfaces.ContainerModule = new ContainerModule(
6666
cachedIdentifierNamesGenerator = identifierNamesGenerator;
6767

6868
return identifierNamesGenerator;
69-
}
69+
};
7070
}
7171
bind<IIdentifierNamesGenerator>(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
7272
.toFactory<IIdentifierNamesGenerator>(identifierNameGeneratorFactory());

src/custom-nodes/string-array-nodes/StringArrayCallsWrapper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export class StringArrayCallsWrapper extends AbstractCustomNode {
101101
...NO_ADDITIONAL_NODES_PRESET,
102102
identifierNamesGenerator: this.options.identifierNamesGenerator,
103103
identifiersDictionary: this.options.identifiersDictionary,
104-
seed: this.options.seed
104+
seed: this.randomGenerator.getRawSeed()
105105
}
106106
).getObfuscatedCode();
107107
}

0 commit comments

Comments
 (0)
0