logo       

SUMMARY : binary file editing using standard tool ?: msg#00070

os.solaris.managers.summaries

Subject: SUMMARY : binary file editing using standard tool ?

How to edit binary without :
- vim/xxd
- perl
- gnutools
- (tr and sed are only for text data)

a solution is to use dd and echo as described by Paul below.

========================================================================
dd is the mother of all commands. This might be painful, but it should work
(I've done something like this in a pinch as well--make sure you know where the
byte to change is because of endian issues).

(
dd ifs=1 ofs=1 if=input_file count=SOME_NUMBER
printf "%c",241
dd ifs=1 ofs=1 if=input_file skip=`expr SOME_NUMBER + 1`
) > output_file
========================================================================

I guess with adb it should work also but I couldn't make it.

Thanks to : Bertrand, Charles, Alan, Darren, Anthony and Paul. :-)


ORIGINAL POST :

> I found a very interesting problem yesterday. I had to modify a binary
> file (replacing a '0' with '1') on a solaris 2.6 system.
> The host was on a high secure net and could not have 3rd party product
> installed.
>
> To change binary file, I use either vim/xxd or perl, unfortunately these
> tools were not installed on this host.
>
> What other standard tools remain if I want, say, to change ".240" with
> ".241" on a binary file ?


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise