Al-Azif

mkexploit672.py

Jul 18th, 2020 (edited)
3,019
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. import sys
  2.  
  3. output = ""
  4.  
  5. with open(sys.argv[1], 'rb') as buf:
  6.     payload = ["0x{:02x}".format(b) for b in buf.read()]
  7.  
  8. size = len(payload)
  9.  
  10. output += "var payload = ["
  11.  
  12. count = 0
  13. for x in payload:
  14.   count = count + 1
  15.   output += "{}".format(int(x, 16))
  16.   if count < size:
  17.     output += ","
  18.  
  19. output += "];\n\n"
  20.  
  21. output += "window.mira_blob_2_len = {};\n".format(hex(size))
  22. output += "window.mira_blob_2 = malloc(window.mira_blob_2_len);\n"
  23. output += "write_mem(window.mira_blob_2, payload);\n"
  24.  
  25. if len(sys.argv) > 2:
  26.   output_file = sys.argv[2]
  27. else:
  28.   output_file = "output.js"
  29.  
  30. with open(output_file, "w") as buf:
  31.   buf.write(output)
Add Comment
Please, Sign In to add comment