How to get hex offset of string
Hi.
I got a file, that I want to patch. I know the hex code I want to patch, but not the offset. How can I do that? Now I am looking for terminal software, that allows me to get the offset of the string, so I can pipe it to xxd. Thanks. |
Not sure why you need xxd, you can just do an inplace edit with sed
|
Because sed cannot replace by offset, just by hex code. Or can it?
sed and xxd are not my problem. The problem is to get the offset. |
Usually to patch binaries you can just match a longer set of hex chars to make it more unique, try 'grep -c <pattern>' with longer patterns until you only get one match then feed it into sed for the search and replace.
Sorry, in answer to your actual question try diff and patch, I can't say I've tried but they're probably a good bet. |
Thanks for the ideas. One problem is that I also have to patch single bytes, which can only be done by offset or I would patch any matching byte of the whole file.
|
I know of bgrep:
https://github.com/tmbinc/bgrep In the past I have made patches in C that search for and patch intelligently. |
I also found the program called strings.
Thanks. Linux mates are the best. |
All times are GMT -5. The time now is 01:48 AM. |