Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试使用 Ubuntu 在 Linux 中修改可执行程序的二进制数据。
我有一个名为a.out. 我可以使用xxd a.out | less. 然后在另一个终端窗口中,我运行vi a.out.
a.out
xxd a.out | less
vi a.out
Vi 的数据在很多地方与 xxd 输出略有不同。两者都将地址显示到文件中,但数据不同。例如,在可执行文件的最开头,在 xxd 中有两个字节C006,在 VI 中显示为c380
C006
c380
有谁知道他们为什么不同?看来VI出于某种原因正在修改一些数据。
我认为您误解了 pipe(|) to less的作用。
xxd a.out, 将在终端上显示 a.out 的十六进制输出。
xxd a.out
xxd a.out | less, 将简单地将输出从 xxd 发送到less以便您可以在命令行上滚动浏览它
我认为你的意思是xxd a.out > file_to_open_in_vi.txt。这实际上会将您的 xxd 输出转储到一个文本文件中,然后您可以使用 vi 打开该文件。
xxd a.out > file_to_open_in_vi.txt