Advertisement
phieulang1993

Coding1

Jul 10th, 2015
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.86 KB | None | 0 0
  1. import urllib2, urllib
  2. def request(url,data,cookie):
  3.     headers = {"Cookie": cookie}
  4.     req = urllib2.Request(url, data, headers)
  5.     response = urllib2.urlopen(req).read()
  6.     return response
  7. url = "https://www.hackthis.co.uk/levels/coding/1"
  8. cookie = "_ga=GA1.3.1205173578.1433484176; member=1; km_ai=x2PU%2FQmuZkE0OR%2F2qGxqE6N7Jqo%3D; km_uq=; km_lv=x; autologin=o-%01%98%7F%09%D3%EBW%22w%FBGc%B5%8C%5C%EC%1E%24%B4n%E7%25%93%E7%02%8F%AC%BB%E2V4%BE%C0%9C%A6%E7%A7%16%7BFc+%8B%C4%D1h%A3%B5%F5s%D9jUs%08J_Z%A1%A1%C1o; PHPSESSID=j0k3ihv246vdijl3om5f7f8a87"
  9. res = request(url,"",cookie)
  10. # print res
  11. i1 = res.index("<textarea>")+len("<textarea>")
  12. i2 = res.index("</textarea>")
  13. words = res[i1:i2].split(", ")
  14. # print words
  15. answer = sorted(words)
  16. # print answer
  17. answer = ", ".join(answer)
  18. # print answer
  19. post_data = "answer="+answer
  20. res = request(url,post_data,cookie)
  21. print res
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement