OSDev.org

The Place to Start for Operating System Developers
It is currently Wed Apr 24, 2024 10:28 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: hexed - command line hexadecimal file editor
PostPosted: Sat Oct 16, 2010 2:31 am 
Offline
Member
Member
User avatar

Joined: Wed May 21, 2008 4:33 am
Posts: 294
Location: Mars MTC +6:00
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=13&t=22122&start=0

_________________
"God! Not Unix" - Richard Stallman

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


Last edited by b.zaar on Thu Oct 21, 2010 1:07 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: hexed - command line heaxadecimal file editor
PostPosted: Sat Oct 16, 2010 9:54 am 
Offline
Member
Member
User avatar

Joined: Tue Mar 06, 2007 11:17 am
Posts: 1225
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=13&t=22122&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.

_________________
Live PC 1: Image Live PC 2: Image

YouTube:
http://youtube.com/@AltComp126/streams
http://youtube.com/@proyectos/streams

http://master.dl.sourceforge.net/projec ... 7z?viasf=1


Top
 Profile  
 
 Post subject: Re: hexed - command line heaxadecimal file editor
PostPosted: Sat Oct 16, 2010 11:04 pm 
Offline
Member
Member
User avatar

Joined: Tue Oct 17, 2006 9:29 pm
Posts: 2426
Location: Canada
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.


Top
 Profile  
 
 Post subject: Re: hexed - command line hexadecimal file editor
PostPosted: Thu Oct 21, 2010 1:56 pm 
Offline
Member
Member
User avatar

Joined: Wed May 21, 2008 4:33 am
Posts: 294
Location: Mars MTC +6:00
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


Top
 Profile  
 
 Post subject: Re: hexed - command line hexadecimal file editor
PostPosted: Sat Nov 06, 2010 4:44 pm 
Offline
Member
Member
User avatar

Joined: Wed May 21, 2008 4:33 am
Posts: 294
Location: Mars MTC +6:00
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


Top
 Profile  
 
 Post subject: Re: hexed - command line hexadecimal file editor
PostPosted: Sat Nov 06, 2010 10:08 pm 
Offline
Member
Member
User avatar

Joined: Tue Mar 06, 2007 11:17 am
Posts: 1225
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:
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:
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 106 times

_________________
Live PC 1: Image Live PC 2: Image

YouTube:
http://youtube.com/@AltComp126/streams
http://youtube.com/@proyectos/streams

http://master.dl.sourceforge.net/projec ... 7z?viasf=1
Top
 Profile  
 
 Post subject: Re: hexed - command line hexadecimal file editor
PostPosted: Tue Nov 09, 2010 2:35 am 
Offline
Member
Member
User avatar

Joined: Wed May 21, 2008 4:33 am
Posts: 294
Location: Mars MTC +6:00
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


Top
 Profile  
 
 Post subject: Re: hexed - command line hexadecimal file editor
PostPosted: Wed Nov 17, 2010 10:09 pm 
Offline
Member
Member
User avatar

Joined: Wed May 21, 2008 4:33 am
Posts: 294
Location: Mars MTC +6:00
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


Top
 Profile  
 
 Post subject: Re: hexed - command line hexadecimal file editor
PostPosted: Thu Nov 18, 2010 10:19 am 
Offline
Member
Member

Joined: Mon Jan 14, 2008 5:53 am
Posts: 188
Location: Helsinki
b.zaar wrote:
The other commands that are planned are: copy, move and find.

What will be semantics of move?


Top
 Profile  
 
 Post subject: Re: hexed - command line hexadecimal file editor
PostPosted: Thu Nov 18, 2010 1:57 pm 
Offline
Member
Member
User avatar

Joined: Wed May 21, 2008 4:33 am
Posts: 294
Location: Mars MTC +6:00
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


Top
 Profile  
 
 Post subject: Re: hexed - command line hexadecimal file editor
PostPosted: Thu Nov 18, 2010 2:02 pm 
Offline
Member
Member

Joined: Mon Jan 14, 2008 5:53 am
Posts: 188
Location: Helsinki
So move deletes the source? Is the destination offset from original or created file?


Top
 Profile  
 
 Post subject: Re: hexed - command line hexadecimal file editor
PostPosted: Fri Nov 19, 2010 3:18 pm 
Offline
Member
Member
User avatar

Joined: Wed May 21, 2008 4:33 am
Posts: 294
Location: Mars MTC +6:00
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


Top
 Profile  
 
 Post subject: Re: hexed - command line hexadecimal file editor
PostPosted: Sat Feb 12, 2011 11:44 am 
Offline

Joined: Sat Feb 12, 2011 11:23 am
Posts: 4
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> .


Top
 Profile  
 
 Post subject: Re: hexed - command line hexadecimal file editor
PostPosted: Sat Feb 12, 2011 7:19 pm 
Offline
Member
Member
User avatar

Joined: Wed May 21, 2008 4:33 am
Posts: 294
Location: Mars MTC +6:00
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


Top
 Profile  
 
 Post subject: Re: hexed - command line hexadecimal file editor
PostPosted: Sat Feb 12, 2011 8:54 pm 
Offline
Member
Member
User avatar

Joined: Wed May 21, 2008 4:33 am
Posts: 294
Location: Mars MTC +6:00
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 111 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group