Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

How to Program directly in hex


ghost's Avatar
0 0

I wish to learn assembly mainly for cracking and editing programs.

However,** I do not wish to get caught up in assembler**s (since I do not wish to make large(or even medium sized) programs,this should not trouble me much).

While browsing through the net,I came across a few tutorials showing the procedure to change programs using Hex editors.

I searched for tutorials and info showing how to make programs using only a hex-editor but found little material about this.

(I really liked http://www.sudowudo.com/index.php?page=1012)

Any help would be greatly appreciated.


ghost's Avatar
0 0
EB 0E 48 65 6C 6C 6F 57 6F 72 6C 64 21 0A 0D 24
B4 09 BA 02 01 CD 21 CD 20 CD 10

Try that as hex in a file with a .com extension. If it works then I fucking rawk!

here's a break down. EB 0E (jmp 14 - we are about to define the string next which can't be executed!) 48 65 6C 6C 6F 57 6F 72 6C 64 21 0A 0D 24 (HelloWorld!\n\r$, $ is liek a null it ends the string) B4 09 (the service for string=>STDOUT) BA 02 01 (The location of the string. 100=EB, 101=0E, 102 is the start of the string.) CD 21 (cd is int 21 is the dos interupt we want) CD 20 (I think this returns to loader) CD 10 (kills program?)

I may have the last two interupts the wrong way around (they are dos specific and I last used dos interupts nearly 5 years ago) as well as the \r\n

it just occured to me that I don't need \r since this is for DOS but it was force of habit!

Best way to learn? Sit down with a x86 opcode book. Then practice without being able to define locations you need to memorise them or predict them I have to make sure my string was 14 characters long so the jmp would work. then I had to guess the location of the string was 102 then break it up to little endiand 20 01 too much work. stick with an assembler.


ghost's Avatar
0 0

**@wolfmankurd: **Thanks,but using a hex editor reduces the work load a lot,you don't have to guess the location of the string or convert it(it shows you both)…however,I shall also try out an assembler(It is more comfortable:)). And it doesn't work(I may have committed some mistake…it executes,but there's no hello world…)

**@986: **I have several hex editors and know how to use a debugger(basics),as with any other beginner,my fav. is Olly Dbg.,but thanks anyway.


ghost's Avatar
0 0

Are you on windows? DEBUG is built in and lets you code in asm dissemble edit and run.

In your hex editor make a new file paste that in as hex (not ascii) then save it as "test.com" It should work, I've just tested it.

It needs to be a com file not an exe as a com file is pure code, an exe has a header etc. It's possible com files are no longer supported in new versions of windows especially 64bit versions.

A quick check bought up over 330 (there are probably quiet a few more including the add on sets) instructions. There is many more opcodes (some instructions have different op codes).

Memorising these will allow you to code using only a hex editor but you skill will be useless outside of your architecture even if you overcome the problem with labels.


ghost's Avatar
0 0

@wolfmankurd: YAY!!!It works and you Rawk:).lI think I should stick to an assembler while learning after all…


ghost's Avatar
0 0

onejerlo wrote: @wolfmankurd: YAY!!!It works and you Rawk:).lI think I should stick to an assembler while learning after all…

=D yay! I always suspected I rawk lmao.