Search code examples
c++cansi-chex-editors

Add/edit string in compiled C program?


I have a strange question, I am wondering if there is a way to add/edit a string (or something that could be accessed via the C program (inside, ie not an external file)) after it has been compiled?

The purpose is to change a URL on an Windows program via PHP on Linux (obviously I cannot just compile it).


Solution

  • Many posix platforms come with the program strings which will read through a binary file searching for strings. There is an option to print out the offset of the strings. For example:

    strings -td myexec
    

    From there you can use a hex editor but the main problem is that you wouldn't be able to make a string bigger than it already is.