- Please read JavaScript Obfuscator: Introduction and Key Concepts.
- Start Project Manager
- Click
- Enter the project input directory - a root directory where all files and subdirectories of the project already reside. It's better to have all files of your project reside there, instead of adding them later after project's creation. No files in that directory will be modified by the tool.
- Enter path to output directory. It's where protected version of the file will be stored. All files in your project's Input Directory that have unknown type of JavaScript Obfuscator will be copied unmodified. It's recommended to use relative path (relative to project's Input Directory), e.g. ../outdir.
- For State Directory name, enter path to a directory where JavaScript Obfuscator will store its state. The directory should exist. It's also recommended to use relative path (relative to project's Input Directory), e.g. ../statedir.
- Specify project files type. This will tell JavaScript Obfuscator which scripts to process - client-side or server-side
to create new project.
- Go to to ensure the file types are detected correctly for all file types. For each file extension present in the project, it's enough to check only one file with that extension - the type of file will be in the right column.
- Add as many libraries that your code uses into project's input directory (e.g. JQuery, Underscore), and go to , and put checkbox near those files/folders, click Add to project button to add them to the project. This will reduce the number of libraries that you will be generating exceptions for in the next steps. Do not worry if those libraries are already minified!
- Generate names of symbols that you are using from a libraries that you are not obfuscating along your project extacting list of symbols , review and manually update that list, and then add it to .
- Generate names of symbols that you export to other developers extacting list of symbols , and and then add them to , so that they are not modified by JavaScript Obfuscator.
- Go to here. The later is preferred as it will result in fewer symbols being in the list of exceptions, meaning that your code will look more cryptic. to review symbols whose names you've used in your code. Review that list. Then either copy that entire list and add it to , or alter your string constants and wrap those symbols in OBJNAME() as explained
- Go to
ReplacementFor_
prefix prepended to them. .
Your project will be built with lite level of protection.
All symbols that are subject to mangling will get - Now try to run your protected code from the output directory, testing all paths of control if possible.
If you get interpreter errors like "
ReplacementFor_FunctionName
can't be found", most probably it means thatFunctionName
is a symbol from 3rd-party library. Either try to add that library to your project (so its code also gets obfuscated), or add its symbols to the list of exceptions adding symbols to exceptions by extracting its symbols extacting list of symbols . If you've already done extracting symbols from that library, it probably means that extraction did not find some symbols, so you have to add them manually. - Repeat 3 last steps (starting from Go to ) until you get no errors while running your protected code.
- Go to and select a production profile you wish to apply to your project and click Save. Go to , then do . Then do very minor check that protected code works fine.
- Your product will then be ready for shipping.
Step-by-Step Guide using GUI (Project Manager)
Useful tips
- If you frequently add files with code that needs to be obfuscated to your project, then instead of
adding them every time using
On that page, you will be asked for processing mode that should be assigned to files with a given file extension. If unsure which mode to specify, go to
and see which mode is used for files with that file extension, and use that mode for unregistered files with that extension. , you can set up how
JavaScript Obfuscator should handle unregistered files of a given file extension, by going to
.
- If you wish to make a snapshot of a project's settings (e.g. before modifying some settings), do . The generated file contains only names of files in your project and all the settings; it does not include file contents, so the file is really tiny, and it's safe to send it to your colleagues. You will be able to import the backup using .
- Building project using command line
-
For each project, it's possible to generate a command line script (or .bat file for Windows)
that will perform all operations available
in
It encapsultes all your project settings because it includes a snapshot of all project's configuration, so you will have to regenerate the script every time you change the options of some modes or add or remove some files from your project (though no regeneration is necessary if you just edit set of exceptions, as settings are stored in separate file in Project's Input Directory).
The documentation on using generated buildscripts is available here - it lists all supported command line flags.
menu. To achieve that, click on
or
.
- If you need running obfuscator directly from command line
- go to to install aliases to command line backends to some directory listed in your PATH environment variable. This way you won't have to type full path to command line tools. Use to generate command lines.
- Project Manager window is a web browser window. So you can use all common web browser shortcuts to navigate it, e.g. for going back to previous screen. On Windows, special build of Firefox is used, that talks to server via named pipes, to avoid problems with firewalls (as they prevent apps accessing even local host). You can turn off this "HTTP over named pipes" mode, and use your favourite browser to work with Project Manager.
- You can open several windows related to your project using window operations buttons in the topmost right corner of the Project Manager window. Using them, you can clone windows. So just clone the window, then navigate to any page you need in new window. You can even open other project in new window. Of course you can also run Project Manager for different obfuscation tools too (e.g. one for JavaScript Obfuscator, one for C/C++ Obfuscator).
- It's possible to edit a set of exceptions using your favourite editor, as it's stored in plain text file. Go to the corresponding page in the