【发布时间】:2018-01-15 08:33:54
【问题描述】:
我写了一个检测人脸的代码并生成了可执行文件,但是当使用radare2打开可执行文件时,我发现函数调用的名称出现了,下图中的绿色句子:
有任何方法可以隐藏这些调用的名称或获取它们的等效二进制文件,以使任何人更难理解该代码在做什么。 谢谢你的建议。
【问题讨论】:
标签: debugging binary executable
我写了一个检测人脸的代码并生成了可执行文件,但是当使用radare2打开可执行文件时,我发现函数调用的名称出现了,下图中的绿色句子:
有任何方法可以隐藏这些调用的名称或获取它们的等效二进制文件,以使任何人更难理解该代码在做什么。 谢谢你的建议。
【问题讨论】:
标签: debugging binary executable
实现这一目标的最佳方法是使用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 剥离符号表。
大多数编译器都具有从二进制文件中剥离符号和调试信息的功能。检查您正在使用的编译器的手册。
【讨论】: