Open hacksysteam opened 3 years ago
Hi,
I was trying this plugin with WebPack 5 and found that identifierNamesCache is not working properly to obfuscate multiple files that depends on each other.
identifierNamesCache
I modified the built index.js to fix this issue.
index.js
Old code:
obfuscate(javascript, fileName, identifiersPrefixCounter) { const obfuscationResult = javascript_obfuscator_1.default.obfuscate(javascript, Object.assign({ identifiersPrefix: `${WebpackObfuscatorPlugin.baseIdentifiersPrefix}${identifiersPrefixCounter}`, inputFileName: fileName, sourceMapMode: 'separate', sourceMapFileName: fileName + '.map' }, this.options)); return { obfuscatedSource: obfuscationResult.getObfuscatedCode(), obfuscationSourceMap: obfuscationResult.getSourceMap() }; }
New code:
obfuscate(javascript, fileName, identifiersPrefixCounter) { const obfuscationResult = javascript_obfuscator_1.default.obfuscate(javascript, Object.assign({ identifiersPrefix: `${WebpackObfuscatorPlugin.baseIdentifiersPrefix}${identifiersPrefixCounter}`, inputFileName: fileName, sourceMapMode: 'separate', sourceMapFileName: fileName + '.map' }, this.options)); this.options.identifierNamesCache = obfuscationResult.getIdentifierNamesCache(); return { obfuscatedSource: obfuscationResult.getObfuscatedCode(), obfuscationSourceMap: obfuscationResult.getSourceMap() }; }
I justed add this.options.identifierNamesCache = obfuscationResult.getIdentifierNamesCache(); and now it works correctly.
this.options.identifierNamesCache = obfuscationResult.getIdentifierNamesCache();
PS: I'm not sure if the issue is in this plugin or javascript-obfuscator itself.
javascript-obfuscator
Thanks.
Hi,
I was trying this plugin with WebPack 5 and found that
identifierNamesCache
is not working properly to obfuscate multiple files that depends on each other.I modified the built
index.js
to fix this issue.Old code:
New code:
I justed add
this.options.identifierNamesCache = obfuscationResult.getIdentifierNamesCache();
and now it works correctly.PS: I'm not sure if the issue is in this plugin or
javascript-obfuscator
itself.Thanks.