隐藏导出的函数,使其不出现在可执行二进制文件中

Hide the exported functions from appearing in the executable binary file

我写了一段检测人脸的代码,生成了可执行文件,但是用radare2打开可执行文件的时候,发现出现了函数调用的名字,如下图绿色语句:

有任何方法可以隐藏这些调用的名称或获取它们的等效二进制文件,从而使任何人都更难理解该代码的作用。 谢谢指教。

剥离

实现该目标的最佳方法是使用 strip。它将丢弃二进制文件中的符号。

你有很多选项,其中最激进的选项是使用 -s--strip-all,这将删除所有符号和重定位信息。

Usage: strip <option(s)> in-file(s)
 Removes symbols and sections from files
 The options are:
  -I --input-target=<bfdname>      Assume input file is in format <bfdname>
  -O --output-target=<bfdname>     Create an output file in format <bfdname>
  -F --target=<bfdname>            Set both input and output format to <bfdname>
  -p --preserve-dates              Copy modified/access timestamps to the output
  -D --enable-deterministic-archives
                                   Produce deterministic output when stripping archives (default)
  -U --disable-deterministic-archives
                                   Disable -D behavior
  -R --remove-section=<name>       Also remove section <name> from the output
  -s --strip-all                   Remove all symbol and relocation information
  -g -S -d --strip-debug           Remove all debugging symbols & sections
     --strip-dwo                   Remove all DWO sections
     --strip-unneeded              Remove all symbols not needed by relocations
     --only-keep-debug             Strip everything but the debug information
  -N --strip-symbol=<name>         Do not copy symbol <name>
  -K --keep-symbol=<name>          Do not strip symbol <name>
     --keep-file-symbols           Do not strip file symbol(s)
  -w --wildcard                    Permit wildcard in symbol comparison
  -x --discard-all                 Remove all non-global symbols
  -X --discard-locals              Remove any compiler-generated symbols
  -v --verbose                     List all object files modified
  -V --version                     Display this program's version number
  -h --help                        Display this output
     --info                        List object formats & architectures supported
  -o <file>                        Place stripped output into <file>

海湾合作委员会

如果您使用 GCC 编译二进制文件,您可以使用 gcc -s 去除符号 table。

其他编译器

大多数编译器都具有从二进制文件中去除符号和调试信息的功能。查看您使用的编译器的手册。