Extracting and using exceptions when using C/C++ 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.

  1. The best option to have exceptions extracted is to use Clang-based symbol extraction tool, just go to Symbols ⇒ Generate exceptions using Clang-based tool. Clang is a modern compiler suite, and it is the default compiler for iOS, macOS, FreeBSD and OpenBSD.

    The Clang-based symbol extraction tool will detect all symbols your code uses from external libraries, without listing symbols that your code does not use from external librariers.

    It will append symbols it found to internal list of exceptions, you DO NOT need to manually cut and paste it to Symbols ⇒ User-Specified exceptions. In 99% of cases there is no need to use any other ways of extracting exceptions described below!

  2. You can put header files 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.

  3. 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.

  4. 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.

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

  1. The easiest way to extract symbols is to use GUI. There is even no need to create any project. See first item on When using GUI tab. The best option to have exceptions extracted when using GUI is to use Clang-based symbol extraction tool, just go to Symbols ⇒ Generate exceptions using Clang-based tool. It's really requires very few steps and accurate in 99% of cases. Unfortunately, there is no way to do that from command line yet.

    There is a way to do the same from command line using extract-syms-from-dir.pl utility, but it has less options.

  2. GUI also allows to extract symbols that are defined in public interface of ActiveX or OLE components, without creating any project. See second item on When using GUI tab for how to do this.

  3. You can create a new project containing only libraries that you need to extact symbols from, and then process it cxx-obfus , appending -D mapping.txt to its command line, and then use first column from mapping.txt as a list of all encountered symbols. 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 take all symbols with that prefix and use them as exceptions.

  4. Produce a list of exceptions manually. Sometimes this is necessary even for symbols from external library too. Simply add them to the file (e.g. exceptions/manual.txt) one per line.

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 C/C++ 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.

To add symbols to exceptions, simply put them to plain text file, one per line, and pass name of that file after -x switch.

You can use empty lines to separate blocks of exceptions.

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

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) and pass its name after -x swtich - cxx-obfus will read all files from that directory.