Guest User

Untitled

a guest
Feb 22nd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # coding: utf-8
  3. import sys
  4. import time
  5.  
  6. # pip install pwn
  7. from pwn import *
  8.  
  9. # pip install ipython
  10. from IPython import embed
  11. from struct import pack,unpack
  12. from binascii import hexlify
  13.  
  14. # Used for delaying after a send vs. a read
  15. # You may not need this
  16. def delay(name):
  17. if name != "":
  18. print("[+] Stage: '%s'" % name)
  19. time.sleep(0.8) # There MUST be a delay due to setvbuf in read()
  20.  
  21. def main(args):
  22. p = None
  23.  
  24. # toggle to remote with ./pwn.py remote
  25. if len(args) == 2 and args[1] == "remote":
  26. p = remote("remote-server-url", 1234)
  27. else:
  28. p = process("./your_pwnable")
  29.  
  30. # Try
  31. # p.recvlines(1), p.recv(10), p.readline()
  32. # p.write('data'), p.write('data with newline')
  33.  
  34. # Note that if your program never ends, you will never see any output
  35. print p.recvall()
  36. sys.exit(0)
  37.  
  38. if __name__ == "__main__":
  39. main(sys.argv)
Add Comment
Please, Sign In to add comment