www.main.lv
Don't think just code it

2009-11-30 Linux ShellCode 1

First shell code writened from example. Shell code is very interesting way how to execute some code.asm source:

use32				
xor eax, eax
inc eax
xor ebx, ebx
int 80h


fasm code.asm code.bin
bin2hex output:
\x31\xc0\x40\x31\xdb\xcd\x80
C source:

#include <stdio.h>
char code[] = "\x31\xc0\x40\x31\xdb\xcd\x80";
int main()
{
  void (*ret)();
  ret = (void (*)())code;
  ret();
  printf("Nope it not working\n");
}


gcc main.c -o main
run
./main
nothing happens. That exactly that code do exits from programm Source

My variant of Bin2Hex