简体   繁体   English

修改ELF文件

[英]Modify ELF file

I have an ELF executable and I would like to know how can I modify its .rodata segment. 我有一个ELF可执行文件,我想知道如何修改其.rodata段。

Also, more generally, how can I modify an ELF executable? 另外,更一般而言,如何修改ELF可执行文件?

You can use any hexeditor to do that, if you know precisely which part of ELF you need to modify. 如果您确切知道需要修改ELF的哪一部分,则可以使用任何hexeditor来执行此操作。

If you want to parse ELFs and do more complex logic you should write some code which will open file or better, mmap it. 如果要解析ELF并执行更复杂的逻辑,则应编写一些代码来打开文件或更好的文件,将其映射。 Then you can read ELF header which gives basic information about ELF and points to other important places in ELF. 然后,您可以阅读ELF标头,其中提供了有关ELF的基本信息并指向ELF中的其他重要位置。 I suggest reading manual for ELF and <include/elf.h> . 我建议阅读ELF和<include/elf.h>

If you are using Linux, you can view where sections lie in memory using readelf or objdump. 如果您使用的是Linux,则可以使用readelf或objdump查看节在内存中的位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM