hexed - command line hexadecimal file editor

This forums is for OS project announcements including project openings, new releases, update notices, test requests, and job openings (both paying and volunteer).
User avatar
b.zaar
Member
Member
Posts: 294
Joined: Wed May 21, 2008 4:33 am
Location: Mars MTC +6:00
Contact:

hexed - command line hexadecimal file editor

Post by b.zaar »

Hi, I'm currently working on a command line hexadecimal file editor called hexed. I have a working rough version but I'm cleaning it up and putting it on sourceforge at http://sourceforge.net/projects/hexed/. It will eventually work as both a command line editor 'hexed -e 100 10 20 30' and as a file editor like hexedit or debug.

I'm making this because I didn't find a good solution for this post: http://forum.osdev.org/viewtopic.php?f= ... 22&start=0
Last edited by b.zaar on Thu Oct 21, 2010 1:07 pm, edited 1 time in total.
"God! Not Unix" - Richard Stallman

Website: venom Dev
OS project: venom OS
Hexadecimal Editor: hexed
User avatar
~
Member
Member
Posts: 1226
Joined: Tue Mar 06, 2007 11:17 am
Libera.chat IRC: ArcheFire

Re: hexed - command line heaxadecimal file editor

Post by ~ »

b.zaar wrote:Hi, I'm currently working on a command line hexadecimal file editor called hexed. I have a working rough version but I'm cleaning it up and putting it on sourceforge at http://sourceforge.net/projects/hexed/. It will eventually work as both a command line editor 'hexed -e 100 10 20 30' and as a file editor like hexedit or debug.

I'm making this because I didn't find a good solution for this post: http://forum.osdev.org/viewtopic.php?f= ... 22&start=0
Could you please include an option or other closely related project to edit/view memory as a file? It would be great for OS debugging of RAM data on real hardware. I was doing a very simple program that just shows all of the contents of the memory, both in hexadecimal and its ASCII characters and can go Up, Down, PgUp and PgDown, but it cannot search binary "text" strings yet.

Also, have you tried HIEW for DOS and Windows? It's very good for text-mode. The Windows version understands Windows API and both can handle EXE headers, and the latest version can disassemble 64-bit x86 binaries. But it seems to be very expensive, at least for me.

I think it would be good to have other open-source alternatives, both different and look-alike.
YouTube:
http://youtube.com/@AltComp126

My x86 emulator/kernel project and software tools/documentation:
http://master.dl.sourceforge.net/projec ... 7z?viasf=1
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: hexed - command line heaxadecimal file editor

Post by Brynet-Inc »

For viewing a hexadecimal/ascii dump of a file I use OpenBSD's hexdump(1)/od(1) programs, for editing I use a small curses based application called hexcurse.

Sadly hexcurse is no longer maintained it seems, but the source tarball is still present on various distfile sites and thus remains available.. it's in the port trees of OpenBSD and FreeBSD, no doubt there are other curses-based editors that could substitute it.

As for what '~' said, viewing the contents of another processes memory isn't something that can be done portably.. there may be an API on Windows, and I believe something like that can be accomplished with ptrace on Unix, but on some systems this is read-only or disabled entirely.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
b.zaar
Member
Member
Posts: 294
Joined: Wed May 21, 2008 4:33 am
Location: Mars MTC +6:00
Contact:

Re: hexed - command line hexadecimal file editor

Post by b.zaar »

b.zaar wrote:Could you please include an option or other closely related project to edit/view memory as a file? It would be great for OS debugging of RAM data on real hardware. I was doing a very simple program that just shows all of the contents of the memory, both in hexadecimal and its ASCII characters and can go Up, Down, PgUp and PgDown, but it cannot search binary "text" strings yet.
I didn't plan on making hexed anything more than a simple file editor so if the memory can be accessed as a file this option will work. It may be something I look at later on though. The main goal I'm working on is being able to run hexed from a script or makefile and do byte replacement in one command. If you know the exact bytes and location to replace values it can be done easily without a search and replace.

The editor currently works like DOS's debug where you dump a range to the screen and enter a range on a command line. d 100 10 - dumps bytes from 0x100 to 0x10f and e 100 10 20 30 - enters the bytes 0x10 0x20 0x30 at 0x100.
I'll try hexcurse and will look at some other options when finishing the editor.
"God! Not Unix" - Richard Stallman

Website: venom Dev
OS project: venom OS
Hexadecimal Editor: hexed
User avatar
b.zaar
Member
Member
Posts: 294
Joined: Wed May 21, 2008 4:33 am
Location: Mars MTC +6:00
Contact:

Re: hexed - command line hexadecimal file editor

Post by b.zaar »

Just a quick update, the first practical version is available. I've finished the code for the commands dump and enter. Source code must be compiled with GNU tools, or Cygwin on Windows.

http://sourceforge.net/projects/hexed/
"God! Not Unix" - Richard Stallman

Website: venom Dev
OS project: venom OS
Hexadecimal Editor: hexed
User avatar
~
Member
Member
Posts: 1226
Joined: Tue Mar 06, 2007 11:17 am
Libera.chat IRC: ArcheFire

Re: hexed - command line hexadecimal file editor

Post by ~ »

Here I have a memory viewer that I made for 16-bit DOS written in assembly. It is one of several modules from my LowEST project (that is in the website in my signature if you find it useful). Currently it can only see the memory, it cannot modify it.

It requires Unreal Mode so to call it first it must be enabled and then the program can be freely used like this:

Code: Select all

unreal86
mview
Then you can use PgUp, PgDown, and Up/Down arrows.

You can specify a starting address from the command line from which to start looking at.

Code: Select all

mview 100000h
Where 100000h can be any valid 32-bit memory address in hex, decimal or even binary.

I also was planning to add a search function from the command line and also from the program, for searching ASCII/binary strings in given ranges of memory or all of it for searching ACPI, VBE signatures and other things, without first having to do a different program every time and actually having a good and easy diagnostic of the memory structures.


__________________________
I forgot to attach it but here it is now....
Attachments
mview.zip
(11.2 KiB) Downloaded 115 times
YouTube:
http://youtube.com/@AltComp126

My x86 emulator/kernel project and software tools/documentation:
http://master.dl.sourceforge.net/projec ... 7z?viasf=1
User avatar
b.zaar
Member
Member
Posts: 294
Joined: Wed May 21, 2008 4:33 am
Location: Mars MTC +6:00
Contact:

Re: hexed - command line hexadecimal file editor

Post by b.zaar »

Is the source for hiew open source?

I wouldn't mind seeing the source code if its available
"God! Not Unix" - Richard Stallman

Website: venom Dev
OS project: venom OS
Hexadecimal Editor: hexed
User avatar
b.zaar
Member
Member
Posts: 294
Joined: Wed May 21, 2008 4:33 am
Location: Mars MTC +6:00
Contact:

Re: hexed - command line hexadecimal file editor

Post by b.zaar »

Another update to hexed, the commands insert and remove have been added.

The other commands that are planned are: copy, move and find.
If people are trying hexed out and have any suggestions for other commands or options (not for the editor yet) let me know.
"God! Not Unix" - Richard Stallman

Website: venom Dev
OS project: venom OS
Hexadecimal Editor: hexed
fronty
Member
Member
Posts: 188
Joined: Mon Jan 14, 2008 5:53 am
Location: Helsinki

Re: hexed - command line hexadecimal file editor

Post by fronty »

b.zaar wrote:The other commands that are planned are: copy, move and find.
What will be semantics of move?
User avatar
b.zaar
Member
Member
Posts: 294
Joined: Wed May 21, 2008 4:33 am
Location: Mars MTC +6:00
Contact:

Re: hexed - command line hexadecimal file editor

Post by b.zaar »

Here's a quick description of the next few commands.

move: -m [dest] [src] [len]

move src from the file to dest in the file, inserts the data at dest.

move overwrite: -mo [dest] [src] [len]

move src from the file to dest in the file, overwrites the data at dest.

copy (-c) and copy overwrite (-co) work in a similiar way but leaves the data at src while copying the data to dest.

find: -f [...]
finds a string of hex values or an ASCII string inside quotes.
"God! Not Unix" - Richard Stallman

Website: venom Dev
OS project: venom OS
Hexadecimal Editor: hexed
fronty
Member
Member
Posts: 188
Joined: Mon Jan 14, 2008 5:53 am
Location: Helsinki

Re: hexed - command line hexadecimal file editor

Post by fronty »

So move deletes the source? Is the destination offset from original or created file?
User avatar
b.zaar
Member
Member
Posts: 294
Joined: Wed May 21, 2008 4:33 am
Location: Mars MTC +6:00
Contact:

Re: hexed - command line hexadecimal file editor

Post by b.zaar »

fronty wrote:So move deletes the source? Is the destination offset from original or created file?
the destination is in the original file before the move, it'll be easier to know the exact location, but the address will change if the source is before the new destination.
berkus wrote:Think cut-copy-paste?
pretty much.
"God! Not Unix" - Richard Stallman

Website: venom Dev
OS project: venom OS
Hexadecimal Editor: hexed
yopla
Posts: 4
Joined: Sat Feb 12, 2011 11:23 am

Re: hexed - command line hexadecimal file editor

Post by yopla »

Hi everyone,
I'm new on here, though in the past I had stumbled on the forum :).

I am looking for a command line driven hex editor. I read the other topic, 'a reasonable hex- editor', good things to know. Though a lot are toward linux.
The only command line hexeditor seems to be this here program, Hexed. It is nice that someone Finally made one, as most are gui based, with only commands to open at a certain offset (no editing). B.zaar , =D>.


I have tried compiling the sources. I am on xp, so I tried gnu Cmake, and make.exe, adding required dlls, but still I'm not able to compile :? Is there a binary somewhere,
orr could that be posted to a very unknowledged newbie? [-o<
Once again, =D> .
User avatar
b.zaar
Member
Member
Posts: 294
Joined: Wed May 21, 2008 4:33 am
Location: Mars MTC +6:00
Contact:

Re: hexed - command line hexadecimal file editor

Post by b.zaar »

yopla wrote:I am looking for a command line driven hex editor. I read the other topic, 'a reasonable hex- editor', good things to know. Though a lot are toward linux.
The only command line hexeditor seems to be this here program, Hexed. It is nice that someone Finally made one, as most are gui based, with only commands to open at a certain offset (no editing). B.zaar , .
Thanks, I'm glad it' seems useful. I've been using it in makefiles or scripts mostly.
yopla wrote:I have tried compiling the sources. I am on xp, so I tried gnu Cmake, and make.exe, adding required dlls, but still I'm not able to compile Is there a binary somewhere,
orr could that be posted to a very unknowledged newbie?
I haven't done much to make it compile in a cross platform way yet, I've been focusing on just getting the main functions working. I've compiled it with both MinGW/MSYS using gcc 4.5.0 and cygwin using gcc 4.3.4. I recommend using MinGW/MSYS so that it compiles to a standard windows executable.

The 'make install' command will not work by default in windows so set 'INSTALL_DIR=/c/apps/hexed' in your environment then make the directory c:\apps\hexed (I found a bug testing this that the makefile wont make the install directory automatically) or you can just copy the executable from PROJECT_BIN to your own directory.

Don't forget to include the path in your PATH environment.
"God! Not Unix" - Richard Stallman

Website: venom Dev
OS project: venom OS
Hexadecimal Editor: hexed
User avatar
b.zaar
Member
Member
Posts: 294
Joined: Wed May 21, 2008 4:33 am
Location: Mars MTC +6:00
Contact:

Re: hexed - command line hexadecimal file editor

Post by b.zaar »

I've just made an update to the Makefile that now includes portability for GNU/Linux, Cygwin and Msys.
It also now creates the INSTALL_DIR if needed.
"God! Not Unix" - Richard Stallman

Website: venom Dev
OS project: venom OS
Hexadecimal Editor: hexed
Post Reply