我想解析给定的二进制文件并使用 C++ 从中提取信息(文本)。
有哪些方法可用?
最佳答案
您可以使用strings(1)将文件中的可打印字符串提取到文件或管道中,然后处理这些行。例如:
$ strings werl.exe
!This program cannot be run in DOS mode.
Rich
.text
`.rdata
@.data
.rsrc
QRVh
Could not load module %s.
win_erlexec
Could not find entry point "win_erlexec" in %s.
Could not find key %s in section %s of file %s
Cannot find erlexec.exe
erts-*
\bin
erts-
要将此输出保存到文件 out.txt
,请使用重定向:
$ strings werl.exe > out.txt
关于c++ - 使用 C++ 从 .exe/.dll 等二进制文件中提取文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4782050/