slow-flag-setter.py (719B)
1 import time 2 3 def main(request, response): 4 headers = [(b"Content-Type", b"text/javascript")] 5 6 result = request.GET.first(b"result", b"success") 7 if result == b"css": 8 time.sleep(3) 9 headers = [(b"Content-Type", b"text/css")] 10 body = u"" 11 else: 12 time.sleep(2) 13 14 body = u""" 15 fetch('exec'); 16 console.log('exec'); 17 if (!window.readyToEvaluate) { 18 window.didExecute = "executed too early"; 19 } else { 20 window.didExecute = "executed"; 21 } 22 """ 23 if result == b"parse-error": 24 body = u"1=2 parse error;" 25 if result == b"fetch-error": 26 return 404, [(b'Content-Type', b'text/plain')], u"""window.didExecute = "fetch error";""" 27 28 return headers, body