Operating System - HP-UX
1821804 Members
3154 Online
109637 Solutions
New Discussion юеВ

Where can I find a tiny HEX editor?

 
John Hall
Frequent Advisor

Where can I find a tiny HEX editor?

I suspect what I want to do here may not be recommended but from time to time I have a need for a HEX editor. For example, I have a binary file and when I do "strings binary-filename" I see a text string (actually a message the binary was compiled to display) that I want to change. I do not intend to make the message any longer (although I may make it shorter and space fill the removed chars). Does anyone know where I can get a tiny HEX editor for HP-UX 11.0 and 11i that I don't need to swinstall or fumble around with dependency products?
18 REPLIES 18
doug mielke
Respected Contributor

Re: Where can I find a tiny HEX editor?

can
xd > vi help here?
John Hall
Frequent Advisor

Re: Where can I find a tiny HEX editor?

Not sure how I would use this (xd > vi) to make a change and save it to the file plus any such editor (even though it may be free) should display ASCII and HEX so you can search for, see, and easily change what you want.
Rodney Hills
Honored Contributor

Re: Where can I find a tiny HEX editor?

If you have "vim" (better vi), then use the -b option.

vim -b myprog

Then you can do searches and edits. Binary values will be displayed in "^" notation.

HTH

-- Rod Hills
There be dragons...
James A. Donovan
Honored Contributor

Re: Where can I find a tiny HEX editor?

You might want to try the fm hex editor. You can get it from here..

http://public.planetmirror.com/pub/hpux/Editors/fm-2.02/

...don;t know how well it works, I've not used it myself....
Remember, wherever you go, there you are...
John Hall
Frequent Advisor

Re: Where can I find a tiny HEX editor?

Rodney H:
Vim requires installing more than I really want to mess with. The key qualities here are the editor be TINY, display ASCII and HEX (side-by-side or every other line), allow for searching & changing data & saving the file, and no install dependencies.

Jim D:
If you haven't tried fm how can you recommend it?
James A. Donovan
Honored Contributor

Re: Where can I find a tiny HEX editor?

I never said I recommended it. You asked for a tiny hex editor. fm is a tiny hex editor....
Remember, wherever you go, there you are...
doug hosking
Esteemed Contributor

Re: Where can I find a tiny HEX editor?

While not exactly what you asked for, it may fill the practical need in many cases, and could be extended to do fancier searches. See attached source file, which I happened to have around for other reasons. I trust that if you're brave enough to do the sort of editing you're talking about that you'll have no trouble compiling it. :-) If it doesn't work, send it back for a full refund of your purchase price.
H.Merijn Brand (procura
Honored Contributor

Re: Where can I find a tiny HEX editor?

I've written "data" in the past.

It's based on vi. When you link "data" to "dump" you have a hex dumper like od -x, but IMHO better.

I've used it to edit /dev/mem :)

Enjoy.
Enjoy, Have FUN! H.Merijn
Bob_Vance
Esteemed Contributor

Re: Where can I find a tiny HEX editor?

Well, I use 'fm' and I love it.
Short,sweet.
I downloaded the source and compiled it, but it's also available from the porting archive
http://hpux.cs.utah.edu/
.
It uses curses and is a screen editor.

Here's a screen shot (ignore the ugly font alignment -- it lines up nicely on a text screen):


---------------------------------------
File: /etc/wtmp
Byte: 0

00 00 00 00 00 00 00 00 00 00 00 00 00 73 79 73 74 ............syst
10 65 6d 20 62 6f 6f 74 00 00 00 00 00 00 02 00 00 em boot.........
20 00 00 00 00 3d 53 d9 2f 00 00 00 00 00 00 00 00 ....=S./........
30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
40 00 00 00 00 00 00 00 00 72 75 6e 2d 6c 65 76 65 ........run-leve
50 6c 20 33 00 00 00 00 00 00 01 00 33 00 53 00 00 l 3........3.S..
60 3d 53 d9 2f 00 00 00 00 00 00 00 00 00 00 00 00 =S./............
70 00 00 00 00 00 00 00 00 76 78 65 6e 61 62 6c 65 ........vxenable
80 76 78 65 6e 00 00 00 00 00 00 00 00 00 00 00 00 vxen............
90 00 00 00 34 00 05 00 00 00 00 00 00 3d 53 d9 2f ...4........=S./
a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
b0 00 00 00 00 76 78 65 6e 61 62 6c 65 76 78 65 6e ....vxenablevxen
c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 34 ...............4
d0 00 08 00 00 00 00 00 00 3d 53 d9 2f 00 00 00 00 ........=S./....
e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
f0 62 63 68 65 63 6b 72 63 62 72 63 31 00 00 00 00 bcheckrcbrc1....

0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef

^f/pgdn=forward ^h/f1=hex ^x/f3=find hex ^u/f5=undo ^g/f7 =goto
^b/pgup=backward ^a/f2=ascii ^t/f4=find ascii ^p/f6=print ^d/f10=done
---------------------------------------


You can edit on either side (i.e., either binary mode or text mode)


bv
"The lyf so short, the craft so long to lerne." - Chaucer
John Hall
Frequent Advisor

Re: Where can I find a tiny HEX editor?

Why does "fm" need curses? What does curses do?
Graham Cameron_1
Honored Contributor

Re: Where can I find a tiny HEX editor?

Curses is a terminal independent screen handling package.
Many unix utilities, including vi, use it.

See "man 3 curses_intro"

-- Graham
Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done.
Jean-Louis Phelix
Honored Contributor

Re: Where can I find a tiny HEX editor?

Hi,

Curses is simply a package to handle screen motions, display and libraries to write applications in termianl mode. It also uses your terminfo files. It's a standard package included in hp-ux, so don't care about it, it's only an information that curses is used. It also means that you don't have to download any other extra package to make fm work ...

Regards.
It works for me (┬й Bill McNAMARA ...)
H.Merijn Brand (procura
Honored Contributor

Re: Where can I find a tiny HEX editor?

You didn't like "data"?

Why not?

# cd /tmp
# gzip -d # ./data -?
# ./data data

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Bob_Vance
Esteemed Contributor

Re: Where can I find a tiny HEX editor?

John,
As said above, curses is just a library for handling the screen. When you set TERM=xxx, it's usually for programs that use curses (curses is what uses the "terminfo" terminal definitions). Most screen-oriented programs use it -- e.g., 'more', 'less', and 'vi' all use curses.



"H." ;>)
'data' looks pretty good :)
I like the "vi" feel, especially the "mark" feature and the full-screen usage. 'fm' was written back when most screens were 24/5 lines and so only uses a 16-line data area to show a convenient hex100 bytes of data.

However, I don't seem to find an ASCII text input or search mode, both of which 'fm' has. Also, FWIW, 'fm' does not write changes until you change screen, so you've got a whole screens worth of "undo".

Now, I've just got to remember to use it ;>)

bv
"The lyf so short, the craft so long to lerne." - Chaucer
H.Merijn Brand (procura
Honored Contributor

Re: Where can I find a tiny HEX editor?

Read the man page. Default search is hex mode. To find in ascii, use

/'

slash quote

tried :c yet?

Nice built-in calculator

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Bob_Vance
Esteemed Contributor

Re: Where can I find a tiny HEX editor?

H.,
Well, of course I read the 'man' page :>)
-- first thing I did ;>)

Neither "search" nor "find" appear therein and there is no mention of ASCII vs Hex mode :{
Of course, while playing, I *did* find " / " -- just not " /' " .


Hey! I just figured out that "a" and "A" are ASCII input mode!! Great!!


So, :>) , I guess one complaint would be the 'man' page . . . which I don't need, now ;>)
Two more lines in the 'man'page and it'll be well-nigh perfect :>)


BTW, John,

'data' uses curses, as well :>)




bv
"The lyf so short, the craft so long to lerne." - Chaucer
John Hall
Frequent Advisor

Re: Where can I find a tiny HEX editor?

Thanks everyone -- very informative!

Procura: I'm sure "data" is a super program you wrote but right now I just needed something quick and rather well known in case I need to ask help from others about how to use it. I probably will explore "data" it in the near future but right now I'm too busy!

Bob Vance: I downloaded and installed "fm" for HP-UX 11.0 and it works fine. If I have a binary on an 11i box I will probably recompile fm for 11i -or- ftp binary to my 11.0, change it there, then ftp it back.
Laurent Menase
Honored Contributor

Re: Where can I find a tiny HEX editor?

you can use adb

adb -w toto
0,3?4Xa
0: 0xab123456 12543345 93452 1
10: 13 43 2 4
20: 2 4 55 0xa
16?W 12345678
16: 16256 = 12345678
$q