Page 1 of 2

hexed - command line hexadecimal file editor

Posted: Sat Oct 16, 2010 2:31 am
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

Re: hexed - command line heaxadecimal file editor

Posted: Sat Oct 16, 2010 9:54 am
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.

Re: hexed - command line heaxadecimal file editor

Posted: Sat Oct 16, 2010 11:04 pm
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.

Re: hexed - command line hexadecimal file editor

Posted: Thu Oct 21, 2010 1:56 pm
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.

Re: hexed - command line hexadecimal file editor

Posted: Sat Nov 06, 2010 4:44 pm
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/

Re: hexed - command line hexadecimal file editor

Posted: Sat Nov 06, 2010 10:08 pm
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....

Re: hexed - command line hexadecimal file editor

Posted: Tue Nov 09, 2010 2:35 am
by b.zaar
Is the source for hiew open source?

I wouldn't mind seeing the source code if its available

Re: hexed - command line hexadecimal file editor

Posted: Wed Nov 17, 2010 10:09 pm
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.

Re: hexed - command line hexadecimal file editor

Posted: Thu Nov 18, 2010 10:19 am
by fronty
b.zaar wrote:The other commands that are planned are: copy, move and find.
What will be semantics of move?

Re: hexed - command line hexadecimal file editor

Posted: Thu Nov 18, 2010 1:57 pm
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.

Re: hexed - command line hexadecimal file editor

Posted: Thu Nov 18, 2010 2:02 pm
by fronty
So move deletes the source? Is the destination offset from original or created file?

Re: hexed - command line hexadecimal file editor

Posted: Fri Nov 19, 2010 3:18 pm
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.

Re: hexed - command line hexadecimal file editor

Posted: Sat Feb 12, 2011 11:44 am
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> .

Re: hexed - command line hexadecimal file editor

Posted: Sat Feb 12, 2011 7:19 pm
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.

Re: hexed - command line hexadecimal file editor

Posted: Sat Feb 12, 2011 8:54 pm
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.