Extracting and using exceptions when using JavaScript Obfuscator suite

Table of contents

Extacting list of symbols

There are several ways to extract a list of exceptions. If not specified otherwise, you should paste extracted exceptions as explained here. Also see extracting exceptions from HTML if your project is web-oriented.

  1. You can put source code of all third-party libraries you use into into separate directory, start Project Manager GUI, go to Tools ⇒ Extract symbols from directory with source files, enter the name of that directory, select symbol types you wish to gather, and get the list of symbols defined in that directory.

  2. For symbols that are defined in public interface of ActiveX or OLE component, it's possible to extract names of these symbols using Project Manager - go to the Tools ⇒ Extract symbols from ActiveX components. For each component your project uses, select the component, click the Extract button, and you will be prompted to save a list of exceptions extracted from the component to the file of your choice.

    Please note that trial version doesn't have this function.

  3. You can create a new project containing only libraries that you need to extact symbols from, and without touching any settings, do Build ⇒ Rebuild all, and then go to Symbols ⇒ View resultant symbol mapping, scroll to bottom and click on Download list of encountered symbols in code from input files - this way you will get names of all symbols found in those libraries .

    You will have to review it and remove names of local variables, names of private symbols, names of arguments passed to functions and then use remaining symbols as exceptions. If all symbols exported by that library have same prefix, then you just select all symbols with that prefix as exceptions.

  4. Produce a list of exceptions manually. Sometimes this is necessary even for symbols from external library too.

Adding symbols to exceptions

To add symbols to exceptions, simply go to Symbols ⇒ User-Specified exceptions and paste the symbol names there, one per line.

You can use empty lines to separate blocks of exceptions.

You can use # to enter comments or comment out some symbols.

You can edit that list with your favourite text editor, as it's stored in plain text file list-of-symbols-for-obfuscator/user-exceptions.txt in your Project Input Directory.

You can also store the symbols in separate files. Just place those files (e.g. manual.txt, library1.txt, library2.txt) into some directory (e.g. named exceptions). To tell JavaScript Obfuscator to read it, go to Settings ⇒ Edit modes ⇒ standard: treat as raw code, scroll to section File-related options, find entry with label "space-separated names of files to get list of exceptions from", put a checkbox to the left of it, and put exceptions into the entry, then click Save at the bottom of the page.

Extracting exceptions from HTML

Project Manager GUI can automatically extract IDs and NAMEs of html elements and form fields, and add them to the list of exceptions. This is done for files that are assigned processing mode containing "special: copy file as is, .. use ids and names of .. elements in it as exceptions" in its name. To change processing mode for a file, go to Settings ⇒ For files , put checkboxes near those files, select mode from drop-down list, click on Assing processing mode

You can review symbols autoextracted this way in Symbols ⇒ View list of autoextracted exceptions.