samedi 7 mars 2015

when can I edit strings in executable binary?


I have an executable binary, let's call it a.out. I can see the binary contains strings



$ strings a.out
...
/usr/share/foo
....


I need to change the string /usr/share/foo to /usr/share/bar. Can I just replace the string with sed?:



sed -i 's@/usr/share/foo@/usr/share/bar@' a.out


This looks like a safe thing to do. Will this also work when the strings are not the same length?



Aucun commentaire:

Enregistrer un commentaire