SHARE
TWEET

PwnTemplate

finalshare Sep 25th, 2018 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import sys
  2. import time
  3. from pwn import *
  4. env = {
  5.     "LD_PRELOAD": "./libc_64.so.6" 
  6. }
  7. glibc=ELF("./libc_64.so.6")
  8. context(os='linux', arch='i386', log_level='debug')
  9.  
  10. GDB = 0
  11. listBp=[
  12. #0xE74,
  13. #0xF7A,
  14. #0xCD8,
  15. ]
  16. def createGDBScript(listBp,pie=False):
  17.     script =""
  18.     for a in listBp:
  19.         if (pie):
  20.             script+="b * "+str(hex(a+0x555555554000))+"\n"
  21.         else :
  22.             script+="b * "+str(hex(a))+"\n"
  23.     script+="c\n"
  24.     return script
  25. if len(sys.argv) >1:
  26.     flag=1
  27.     r = remote("chall.pwnable.tw", 10203)
  28. else:
  29.     flag=0
  30.     r = process("./secretgarden",aslr=False)
  31.  
  32.     if (GDB):
  33.     gdb.attach(r,gdbscript=createGDBScript(listBp,pie=True))
  34.  
  35. def main():
  36.    
  37.     r.interactive()
  38. if __name__ == "__main__":
  39.     main()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top