Ok, I won't guarantee that this will work for you. But here is a way to change a string in an executable. You will need the gnu strings command. It is available in the binutils package at sunfreeware. So I need a binary to fiddle with....
$ cp /usr/bin/ftp .
$ ./ftp
ftp> help
Commands may be abbreviated. Commands are:
! cd edit help mdir newer prompt reset size user
$ cdup epsv4 idle mget nlist proxy restart status verbose
account chmod exit image mkdir nmap put rhelp struct ?
append close form lcd mls ntrans pwd rmdir sunique
ascii cr ftp less mode open quit rstatus system
bell debug get lpwd modtime page quote runique tenex
binary delete gate ls more passive recv send trace
bye dir glob macdef mput preserve reget sendport type
case disconnect hash mdelete msend progress rename site umask
ftp> bye
$
Ok, Let's say that my auditors are demanding that I render the word abbreviated in all caps. This means that my replacement text has the exact same number of characters as my original text. That is important. I can change the text easily but changing the size is harder. I need to locate the string and that is why I am using the GNU strings program.
$ strings -t d -a -n 7 ftp | grep abbreviated
290112 %sommands may be abbreviated. Commands are:
$
There is my string but I need to code up a dd command that isolates it. It looks about 15 characters long starting a little bit after 290112. So I try...
$ dd if=./ftp bs=1 skip=290130 count=15 | od -A n -c
15+0 records in
15+0 records out
15 bytes transferred in 1 secs (15 bytes/sec)
b b r e v i a t e d . C o
This got me close. But I need it exact...
$ dd if=./ftp bs=1 skip=290129 count=11 | od -A n -c
11+0 records in
11+0 records out
11 bytes transferred in 1 secs (11 bytes/sec)
a b b r e v i a t e d
$
OK, that got it. What I really want to do is crack my ftp executable up into 3 pieces: the stuff before my string, my string, and the stuff after my string. This will take 3 dd statements and now I know how to code them...
$ dd if=./ftp bs=1 count=290129 of=ftp.1
290129+0 records in
290129+0 records out
290129 bytes transferred in 2 secs (145064 bytes/sec)
$ dd if=./ftp bs=1 skip=290129 count=12 of=ftp.2
12+0 records in
12+0 records out
12 bytes transferred in 1 secs (12 bytes/sec)
$ dd if=ftp bs=1 skip=290141 count=999999999 of=ftp.3
38563+0 records in
38563+0 records out
38563 bytes transferred in 1 secs (38563 bytes/sec)
Now I want to be sure that the middle piece is the string I am expecting and then I want to change the string...
$ od -A n -c ftp.2
a b b r e v i a t e d .
$ print -n ABBREVIATED. > ftp.2
$ od -A n -c ftp.2
A B B R E V I A T E D .
$
Now I can reassemble the the pieces into a new binary and try it out...
$ cat ftp.* > ftp2
$ chmod u+x ftp2
$ ./ftp2
ftp> help
Commands may be ABBREVIATED. Commands are:
! cd edit help mdir newer prompt reset size user
$ cdup epsv4 idle mget nlist proxy restart status verbose
account chmod exit image mkdir nmap put rhelp struct ?
append close form lcd mls ntrans pwd rmdir sunique
ascii cr ftp less mode open quit rstatus system
bell debug get lpwd modtime page quote runique tenex
binary delete gate ls more passive recv send trace
bye dir glob macdef mput preserve reget sendport type
case disconnect hash mdelete msend progress rename site umask
ftp> bye
$ ./ftp
ftp> help
Commands may be abbreviated. Commands are:
! cd edit help mdir newer prompt reset size user
$ cdup epsv4 idle mget nlist proxy restart status verbose
account chmod exit image mkdir nmap put rhelp struct ?
append close form lcd mls ntrans pwd rmdir sunique
ascii cr ftp less mode open quit rstatus system
bell debug get lpwd modtime page quote runique tenex
binary delete gate ls more passive recv send trace
bye dir glob macdef mput preserve reget sendport type
case disconnect hash mdelete msend progress rename site umask
ftp> bye
$
That is pretty much it. But you need to get the arithmetic right or it won't work.