Converting code into HEX????

Hey, im using FreeBSD 5.0.3

How do i convert ASM code into HEX opcodes?

Example: Convert
xor eax, eax
push eax
push 0x68732f2f
push 0x6e69622f
mov esp,ebx
push eax
push ebx
mov esp,ecx
cdq
mov 0x0b,al
int 0x80

Comments

  • : Hey, im using FreeBSD 5.0.3
    :
    : How do i convert ASM code into HEX opcodes?
    :
    : Example: Convert
    : xor eax, eax
    : push eax
    : push 0x68732f2f
    : push 0x6e69622f
    : mov esp,ebx
    : push eax
    : push ebx
    : mov esp,ecx
    : cdq
    : mov 0x0b,al
    : int 0x80
    :
    With an assembler? Assemble it - you can probably give your assembler flags to tell it not to link it into an executable and just give you the raw machine code - then look at it in a hex editor. That and/or get the Intel instruction set guide from the Intel site (look up the processor you're interested in, then see its data sheet) and do it by hand. x86 is fun 'cus the instruction lengths vary. Guess a hack to help you with this is to shove a no-op between each instruction, so whenever you see an 0x90 (I think!) you know that's where the last instruction ended. Yeah, I'm crude and evil and the folks who've done this for ages will probably know way better than me. :-)

    Jonathan

    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion