Question Locked

Hex file reader

0 helpful
14 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
Hi.I wanted to ask if there was any way to display the contents of a hex file.I have a file with the extension '.hex'.I know its part of a program code which i got from somewhere(only a hex file,nothing else).I wish to make changes in the program.Is there any way i can edit the contents of the program using only the hex file,or like,is there a possibility of recovering the program using the hex file only?

14 replies

by yoginc

i tried that and i found some software..i tried them and they open and display the contents as an array of hex numbers with offsets.They made no sense to me.However i did find i could 'export' the file in some other extension(like *.cpp,*.c,*.html etc.).If i export it as a .cpp file,will i be able to view it in a C++ simulator?

by brian

Try OllyDBG (it will take some digging to find, but it might work for you)

by seanferd

If it is a C++ source file, you'll be able to view it in a C++ IDE. If it is compiled, you'll need a decompiler or debugger.

by robo_dev

...discussion of which is probably against the rules around here :)

by seanferd

One could probably find a dissassembler that handles files created in a number of different languages. Of course, getting the complete original source out is not terribly likely, AFAIK, with any method. Sometimes tools like these have worked well enough for what I've needed to find out, but not always.

by robo_dev

My experience has been that typically you can trace the program logic, and maybe sorta figure out what modules do what, but it's like turning sausage back into a pig....rotsa ruck with that.

The more useful thing often is to run the program in a debugger, but I digress.... I've used a tool called IDA Pro, PE Browse Pro, and a whole raft of others I cannot remember.

by seanferd

for confirming my not-very-well-informed suspicions. :D

by yoginc

So you are saying that there are some software like disassemblers which might be available that could give you the the complete program from the hex file...Actually this will be my first hand in high level programming as i have never tried it before.

by seanferd

but you will not get full source code out of it. You'll get some c-like structures and a bunch of assembly code.

by robo_dev

In terms of reverse-engineering, you cannot really get the source back from compiled code; it does not work that way. While there are some things that it can figure out if it's a very simple program, at most it's hit-or-miss. And don't forget that these tools are made for one specific program...you need a decompiler specific to DOS executables, and a specific one for flash, etc. etc.

What I've seen is that you get back are some snippets of code, which give you a rough idea of the program flow. If the program is security related, or the developer does not want it to be hacked, he/she can use encryption and a great deal of obfuscation to frustrate any attempts to decompile and steal the code. And on top of that, what you can end up with is like 100,000 lines of un-commented and incomplete code...a real pain to work with.

To clarify, a disassembler is a computer program that translates machine language into assembly language, while a decompiler attempts to return machine code all the way back up to source code.

by yoginc

oh well..thank you all anyway.Got to know about a lot of stuff...i guess i'll try to look for a 'decompiler' if possible,otherwise i guess i'll have to start from scratch and create the full source code myself.Thank you all once again.

This discussion is closed to new replies.