PhieuLang

15_ELF

Mar 30th, 2015
393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.71 KB | None | 0 0
  1. import urllib2
  2. import hashlib
  3. def request(url,data,cookie):
  4.     headers = {"Cookie": cookie}
  5.     req = urllib2.Request(url, data, headers)
  6.     response = urllib2.urlopen(req).read()
  7.     return response
  8.  
  9. cookie = "XXX"
  10. url = "http://ringzer0team.com/challenges/15"
  11. res = request(url,"",cookie)
  12. s1 = "----- BEGIN Elf Message -----<br />"
  13. s2 = "<br />"
  14. i1 = res.index(s1)+len(s1)
  15. i2 = res.index(s2,i1)
  16. data = res[i1+4:i2]
  17. while "FLE" not in data:
  18.     data = data.decode("base64")
  19. data=data[::-1]
  20. s1 = "31c0c7".decode("hex")
  21. s2 = "66c745f4".decode("hex")
  22. id = data.index(s1)
  23. key = data[id+5:id+15].replace(s2,"")
  24. url = "http://ringzer0team.com/challenges/15/"+key
  25. res = request(url,"",cookie)
  26. print res[res.index("FLAG-"):]
Advertisement
Add Comment
Please, Sign In to add comment