My first shellcode :)
/*
* File: shello.c
*
* Generated from this assembly code:
* pushl %ebp
* movl %esp, %ebp
*
* subl $12, %esp
* movl $0x6c6c6548, -12(%ebp)
* movl $0x6f57206f, -8(%ebp)
* movl $0x0a646c72, -4(%ebp)
*
* movl $4, %eax
* movl $1, %ebx
* leal -12(%ebp), %ecx
* movl $12, %edx
*
* int $0x80
* addl $12, %esp
*
* leave
* ret
*
*/
/*
* Tested on Linux hilstdsk 3.2.7-1-ARCH #1 SMP PREEMPT Tue Feb 21
* 16:59:04 UTC 2012 i686 AMD Athlon(tm) 64 X2 Dual Core Processor
* 4400+ AuthenticAMD GNU/Linux
* Archlinux
*/
/*
* Compile: gcc -o shello shello.c
* Run: ./shello
* Output: Hello World
*/
/*
* Thats pretty cool!
*/
#include
static char shellcode[] = "\x55"
"\x89\xe5"
"\x83\xec\x0c"
"\xc7\x45\xf4\x48\x65\x6c\x6c"
"\xc7\x45\xf8\x6f\x20\x57\x6f"
"\xc7\x45\xfc\x72\x6c\x64\x0a"
"\xb8\x04\x00\x00\x00"
"\xbb\x01\x00\x00\x00"
"\x8d\x4d\xf4"
"\xba\x0c\x00\x00\x00"
"\xcd\x80"
"\x83\xc4\x0c"
"\xc9"
"\xc3";
int main(void)
{
void (*p)(void);
p = shellcode;
p();
return 0;
}