Edit variable values in ELF file?

依然范特西╮ 提交于 2019-12-03 09:13:05

"gdb --write /your/application/binary" should be able to change value of initialized data and write it back to the executable.

Add "-batch" and "-x command_file" and you should be able to get it to do what you want.

QNX has a built-in tool called "spatch" that allows you to do exactly this. The other suggestions to use gdb or a hex editor are equally valid.

While patching binary code is totally possible, it sounds like you're doing it wrong :-). Perhaps these values would be better suited to be stored in some data file distributed with the binary and read in during a constructor of some sort? Unless you have some compelling reason to require this to be in the binary, I would seriously look at the design and see if you really need to do this.

If the answer you come up with is "yes, I really need to do this," then great. You've got a couple very valid methods suggested for accomplishing this. Good luck.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!