Python Hex editor

Jun 17, 2010 at 8:11 PM
Not anymore
"Run, rabbit run. Dig that hole, forget the sun."
Join Date: Jan 28, 2010
Location: Internet
Posts: 1369
Age: 34
Pronouns: he/him
Well, today I made my own hex editor.

The editor is a small little python script file. It was actually quite easy to make, but it's also kind of primitive at this stage, since everything is done through command line. You can still do the basics, such as reading/writing hex values for any file, as well as reading/writing ascii characters if you need to do that.

diph.php


diph.php


=== Some Commands ===
open X - Opens the file with filename X for editing.

name - Shows the filename of the file that is currently opened.

offset X - Sets the starting offset to hexadecimal number X.

decoffset X - Sets the starting offset to decimal number X.

readhex - Displays a block of hex codes, which start at the offset specified by the offset commands.

writehex [hex string] - Writes a string of hex codes directly into the file starting at the offset specified by the offset commands. (example: writehex 4A 6B 32 FF 00 AC 5B 5C)

readascii - Shows a block of ascii characters from the file, starting at the offset specified in the offset commands.

writeascii [ASCII text] - Converts a block of ASCII characters into their respective hex codes, then writes those hex codes directly into the file starting at the offset specified by the offset commands. (example: writeascii A125fe89305euqn25m3)

readsize X - Changes the maximum number of ASCII characters displayed by the command readascii to X.

readlineshex X - Changes the maximum number of hex code lines displayed by the command readhex to X.

showvars - Displays the numbers that are stored in the offset, readsize, and readlineshex variables.

exit - Closes the program.
========

Example hack:
Put Doukutsu.exe in the same folder as the program. Then use the commands:

open Doukutsu.exe
offset 83AF
writehex 57
offset 83ED
writehex 57
offset 8428
writehex 57
offset 8463
writehex 57
exit

This will cause the Nemesis bullets to produce hearts (yes, the healing kind) instead of smoke.

So, what was the point of all this?

Well, I can easily make this more Cavestory specific. For example, I could make a program that could
auto-install a certain type of ASM hack into a Cavestory executable, given the correct offsets and hex codes needed to do it.
Also, since this is a Hex editor in its early stages, writing a custom disassembler is not far off.

If you want to see it, it's available here. Please read the "User Guide.html" for extra information on the commands.
 
Jun 17, 2010 at 8:17 PM
In my body, in my head
Forum Moderator
"Life begins and ends with Nu."
Join Date: Aug 28, 2009
Location: The Purple Zone
Posts: 5998
Pronouns: he/him
I see this as something that will let me apply a double-res or other hack to a blank .exe with the touch of a button, something I don't really know how to do with a standard hex editor.

Am I right? Can I set up some sort of auto-hacking... thing?
Because that'd be useful. It'd also be useful for the WAV org fix, so you wouldnt have to know how to use the debugger.
 
Jun 17, 2010 at 8:22 PM
Not anymore
"Run, rabbit run. Dig that hole, forget the sun."
Join Date: Jan 28, 2010
Location: Internet
Posts: 1369
Age: 34
Pronouns: he/him
Noxid said:
I see this as something that will let me apply a double-res or other hack to a blank .exe with the touch of a button, something I don't really know how to do with a standard hex editor.

Am I right? Can I set up some sort of auto-hacking... thing?
Because that'd be useful. It'd also be useful for the WAV org fix, so you wouldnt have to know how to use the debugger.

Yes. Auto-hacking is perfectly doable. Just need the hex codes and the addresses and I can make you an ASM hack-installer program.
 
Jun 17, 2010 at 8:27 PM
In my body, in my head
Forum Moderator
"Life begins and ends with Nu."
Join Date: Aug 28, 2009
Location: The Purple Zone
Posts: 5998
Pronouns: he/him
Well I can't *GIVE* the double-res ones to anybody but you could try it with the WAV hack available on the MP3 in Cave Story Thread.
 
Jun 17, 2010 at 8:31 PM
Not anymore
"Run, rabbit run. Dig that hole, forget the sun."
Join Date: Jan 28, 2010
Location: Internet
Posts: 1369
Age: 34
Pronouns: he/him
Noxid said:
Well I can't *GIVE* the double-res ones to anybody but you could try it with the WAV hack available on the MP3 in Cave Story Thread.

Hmm... good point. Perhaps I'll start working on a general-purpose hack installer, so that you don't have to give me any hex codes for 2x res. (it'll be like "put text files with hex data in this folder. Have an offset at first line of each file, rest is hex data. Then run the program. Hack installed.")
 
Jun 17, 2010 at 8:40 PM
Pirate Member
"Heavy swords for sale. Suitable for most RPG Protagonists. Apply now!"
Join Date: Dec 26, 2007
Location: Lithuania
Posts: 1946
carrotlord said:
Hmm... good point. Perhaps I'll start working on a general-purpose hack installer, so that you don't have to give me any hex codes for 2x res. (it'll be like "put text files with hex data in this folder. Have an offset at first line of each file, rest is hex data. Then run the program. Hack installed.")

That sounds easy enough, even for a newb such as myself who couldn't tell the difference between an offset and a taco.
 
Jun 19, 2010 at 1:33 PM
Administrator
Forum Administrator
"Life begins and ends with Nu."
Join Date: Jul 15, 2007
Location: Australia
Posts: 6224
Age: 39
Pronouns: he/him
Back
Top