
Product
Socket Now Available on Google Cloud Marketplace
Socket, the leader in open source security, is now available on Google Cloud Marketplace for simplified procurement and enhanced protection against supply chain attacks.
obfuscator
Advanced tools
Obfuscate your node packages because your boss says so!
Because I had this conversation:
me: hi boss. this application should be written in node, not java. node is good and stuff.
boss: oh, okay. node sounds great. what about code protection so people don't steal our software?
me: ...
boss: you can't use node.
... but now:
me: hi boss. first off, code protection is stupid. secondly, java can be decompiled.
boss: but decompiling java is a lot of work.
me: so is un-obfuscating javascript!
-g
flag)$ obfuscator --entry app.js ./app.js ./routes/index.js ./routes/user.js
var Options = require('obfuscator').Options;
var obfuscator = require('obfuscator').obfuscator;
var fs = require('fs');
var options = new Options([ '/path/to/file1.js', '/path/to/file2.js' ], '/path/to', 'file1.js', true);
// custom compression options
// see https://github.com/mishoo/UglifyJS2/#compressor-options
options.compressor = {
conditionals: true,
evaluate: true,
booleans: true,
loops: true,
unused: false,
hoist_funs: false
};
obfuscator(options, function (err, obfuscated) {
if (err) {
throw err;
}
fs.writeFile('./cool.js', obfuscated, function (err) {
if (err) {
throw err;
}
console.log('cool.');
});
});
Also see acceptance tests or the docs.
Think browserify only for node, plus UglifyJs. Your entire project will be concatenated into a single file. This file will contain a stubbed require
function, which will handle everything for you. This single file will be run through UglifyJs, making it more difficult to read.
Undoing this process is hopefully as painful as decompiling java bytecode.
root
of your project.require
features; only require.cache
and require.resolve
have been exposed.module.
require()
s are not supported; chances are, there's a significantly cleaner way of handling loading your depenencies anyway.(The MIT License)
Copyright (c) 2013-2014 Stephen Mathieson <me@stephenmathieson.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Code protection / obfuscation for node
The npm package obfuscator receives a total of 309 weekly downloads. As such, obfuscator popularity was classified as not popular.
We found that obfuscator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket, the leader in open source security, is now available on Google Cloud Marketplace for simplified procurement and enhanced protection against supply chain attacks.
Security News
Corepack will be phased out from future Node.js releases following a TSC vote.
Research
Security News
Research uncovers Black Basta's plans to exploit package registries for ransomware delivery alongside evidence of similar attacks already targeting open source ecosystems.